Working Checklist

It would be cool to have a checklist that people could easily edit and use.

Here is a basic checklist I have for anyone to use and build from.

Wishlist Features:
Add button + adds addition checklist statements that are written in text box
Remove button - revmoves that checklists object from the dialog
as the buttons are use the dialog expands and contracts.

the add and remove buttons do not work yet.

Thanks
JokerMartini

rollout rlChecklist "Check List"
(
	button btnAdd "+" width:17 height:17 pos:[0,0]
	editText etToDoList "" fieldwidth:152 pos:[13,0]
	label lbDivide "- - - - - - - - - - - - - - - - - - - - - - - -" pos:[2,18]
 
	label lb1 "Render Resolution" pos:[67,40]
	label lb2 "Motion Blur" pos:[67,62]
	checkbox ckbx1 "" pos:[36,39] width:12 enabled:false
	checkbox ckbx2 "" width:12 pos:[36,61] enabled:false
	button btn1 "O" width:24 height:24 pos:[6,32]
	button btn2 "O" width:24 height:24 pos:[6,56]
	button btn1delete "-" width:13 height:13 pos:[51,40]
	button btn2delete "-" width:13 height:13 pos:[51,62]
 
	label lbDivide2 "- - - - - - - - - - - - - - - - - - - - - - - -" pos:[2,80]
 
	button btnClear "Clear" width:138 height:24
 
	on btn1 pressed do
	(
		ckbx1.checked = true
	)
 
	on btn2 pressed do
	(
		ckbx2.checked = true
	)
 
	on btnClear pressed do
	(
		ckbx1.checked = ckbx2.checked = false
	)
 
)
createDialog rlChecklist 170 130

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Swordslayer's picture

Tweaked

You mentioned on your site that is says a seperate file for each user? What do you mean by that exactly? Does the checklist save with the max file is that what you mean? if so is it a unique file for each max scene?

It simply saves the file in current user's folder so when someone else is logged in and runs it, your tasks stay intact. This can be changed by altering local file_name = ... – for example switching "\\to-do.list" for "\\to-do" + maxFileName + ".list". That would make a new file for every file you open when evaluated; when working on a new scene without any filename the file would stay as it is now. This is more a lazy hack than a real solution, there are many ways to achieve that but with most of them you lose your data when the scene is unsaved. It always depends on what you want to achieve.

It is a big finiky when i select the items in the list. It automatically unchecks stuff. Maybe its just me. Let me know what you think.

Yeah, that's an old bug in listview, for more info you can look here: CGTalk :: Selecting multiple items toggles the checked states I'm attaching updated version with the solution posted there implemented in it:

try destroyDialog listview_rollout catch()
rollout listview_rollout " Task List v 0.02" width:190 height:300
(
    editText etTaskName "" width:75 pos:[6,8]
    button btnAdd "Add" pos:[85,7]
    button btnRemove "Remove" pos:[121,7]
    dotNetControl dncTaskList "System.Windows.Forms.ListView" pos:[3,37] width:184 height:260
 
    local dn_listitem = dotNetClass "System.Windows.Forms.ListViewItem"
    local dn_buttons = dotNetClass "System.Windows.Forms.MouseButtons"
    local dn_file = dotNetClass "System.IO.File"
    local dn_streamwriter = dotNetClass "System.IO.StreamWriter"
    local dn_streamreader = dotNetClass "System.IO.StreamReader"
    local dn_garbage = dotNetClass "System.GC"
    local file_name = ((dotNetClass "System.Windows.Forms.Application").LocalUserAppDataPath + "\\to-do.list")
    local file_stream = undefined
	local check_states, sel_nums, sel_nums_count
 
    on listview_rollout open do
    (
        dncTaskList.View = (dotNetClass "System.Windows.Forms.View").Details
            dncTaskList.BorderStyle = dncTaskList.BorderStyle.FixedSingle
            dncTaskList.FullRowSelect = true
            dncTaskList.GridLines = true
            dncTaskList.CheckBoxes = true
            colums_arr = #(#(" ", 18), #("Task", 166))
            for i in colums_arr do (dncTaskList.Columns.Add i[1] i[2])
 
        if doesFileExist file_name do
        (
            local read_line, list_items = #()
            local new_item = dotNetObject dn_listitem ""
            new_item.SubItems.Add ""
 
 
            file_stream = dotNetObject dn_streamreader file_name
            while (read_line = file_stream.ReadLine()) != undefined do
            (
                local line_item = filterString read_line "\t"
                list_item = new_item.Clone()
                list_item.Checked = line_item[1] as booleanClass    
                list_item.SubItems.Item[1].Text = line_item[2]
 
                append list_items list_item
            )
 
            dncTaskList.Items.AddRange list_items            
            list_items = undefined
 
            file_stream.Close()
            file_stream.Dispose()
            file_stream = undefined
            dn_garbage.collect()
            gc light:true
        )
    )
 
    on btnAdd pressed do
    (
        if etTaskName.text != "" do
        (
            local new_item = dotNetObject dn_listitem ""
            new_item.SubItems.Add etTaskName.text
            new_item.Checked = false
            dncTaskList.Items.Add new_item
            new_item = undefined
        )
    )
 
    on btnRemove pressed do
    (
        selected_count = dncTaskList.SelectedItems.Count - 1
        for index = selected_count to 0 by -1 do
            dncTaskList.Items.Remove dncTaskList.SelectedItems.Item[index]
    )
 
	on dncTaskList ItemSelectionChanged do
	(
		local selected_count = dncTaskList.selectedIndices.count - 1
	  	sel_nums = for each = 0 to selected_count collect
			dncTaskList.SelectedIndices.Item[each]
		sel_nums_count = sel_nums.count
	  	check_states = for each = 1 to sel_nums_count collect
			dncTaskList.Items.Item[sel_nums[each]].Checked	
	)
 
	on dncTaskList MouseUp ctrl evnt do
	(
		if evnt.Button == dn_buttons.Left do
		(
	  		for item = 1 to sel_nums.count do
				dncTaskList.Items.Item[sel_nums[item]].Checked = check_states[item]
			check_states = #()
	 		sel_nums = #()
		)
	)
 
    on listview_rollout resized rollout_size do
    (
        if rollout_size[1] <= 190 do
            listview_rollout.width = 190 --limit dialog resizing
        if rollout_size[2] <= 150 do
            listview_rollout.height = 150
 
        dncTaskList.Size = dotNetObject "System.Drawing.Size" (listview_rollout.width - 6) (listview_rollout.height - 40)
        dncTaskList.Columns.Item[1].Width = (listview_rollout.width - 24)   
    )
 
    on listview_rollout close do
    (
        file_stream = dotNetObject dn_streamwriter (dn_file.Create file_name)
        item_count = listview_rollout.dncTaskList.Items.Count - 1
 
        for index = 0 to item_count do
            file_stream.WriteLine ((local list_item = listview_rollout.dncTaskList.Items.Item[index]).Checked as string + "\t" + list_item.SubItems.Item[1].Text)
 
        file_stream.Close()
        file_stream.Dispose()
        file_stream = undefined
    )
)
createDialog listview_rollout style:#(#style_titlebar, #style_sysmenu, #style_minimizebox, #style_resizing)
JokerMartini's picture

Thanks

That is great. The bug is a rather annoying little thing. I'm glad there is a solution for it. Thanks for the revised version with the addition fixes.

I'm going to further develop this script for a more stream line use!
I'll be sure to keep you in the loop.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

cool

i like this

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

Tweaks

It is a big finiky when i select the items in the list. It automatically unchecks stuff. Maybe its just me. Let me know what you think.

try destroyDialog listview_rollout catch()
rollout listview_rollout " Task List" width:190 height:300
(
    editText etTaskName "" width:75 pos:[6,8]
    button btnAdd "+" width:20 height:20 pos:[86,7]
    button btnRemove "-" width:20 height:20 pos:[106,7]
	button btnUncheck "Uncheck" width:60 height:20 pos:[126,7]
    dotNetControl dncTaskList "System.Windows.Forms.ListView" pos:[3,37] width:184 height:260
 
    local dn_listitem = dotNetClass "System.Windows.Forms.ListViewItem"
    local dn_file = dotNetClass "System.IO.File"
    local dn_streamwriter = dotNetClass "System.IO.StreamWriter"
    local dn_streamreader = dotNetClass "System.IO.StreamReader"
    local dn_garbage = dotNetClass "System.GC"
    local file_name = ((dotNetClass "System.Windows.Forms.Application").LocalUserAppDataPath + "\\to-do.list")
    local file_stream = undefined
 
    on listview_rollout open do
    (
        dncTaskList.View = (dotNetClass "System.Windows.Forms.View").Details
            dncTaskList.BorderStyle = dncTaskList.BorderStyle.FixedSingle
            dncTaskList.FullRowSelect = true
            dncTaskList.GridLines = true
            dncTaskList.CheckBoxes = true
            colums_arr = #(#(" ", 18), #("Task", 166))
            for i in colums_arr do (dncTaskList.Columns.Add i[1] i[2])
 
        if doesFileExist file_name do
        (
            local read_line, list_items = #()
            local new_item = dotNetObject dn_listitem ""
            new_item.SubItems.Add ""
 
            file_stream = dotNetObject dn_streamreader file_name
            while (read_line = file_stream.ReadLine()) != undefined do
            (
                local line_item = filterString read_line "\t"
                list_item = new_item.Clone()
                list_item.Checked = line_item[1] as booleanClass    
                list_item.SubItems.Item[1].Text = line_item[2]
 
                append list_items list_item
            )
 
            dncTaskList.Items.AddRange list_items            
            list_items = undefined
 
            file_stream.Close()
            file_stream.Dispose()
            file_stream = undefined
             dn_garbage.collect()
            gc light:true
        )
    )
 
    on btnAdd pressed do
    (
        if etTaskName.text != "" do
        (
            local new_item = dotNetObject dn_listitem ""
            new_item.SubItems.Add etTaskName.text
            new_item.Checked = false
            dncTaskList.Items.Add new_item
            new_item = undefined
        )
    )
 
    on btnRemove pressed do
    (
        selected_count = dncTaskList.SelectedItems.Count - 1
        for index = selected_count to 0 by -1 do
            dncTaskList.Items.Remove dncTaskList.SelectedItems.Item[index]
    )
 
	on btnUncheck pressed do
	(
		selected_count = dncTaskList.SelectedItems.Count - 1
        for index = selected_count to 0 by -1 do
		(
			dncTaskList.SelectedItems.Item[index].checked = false
		)
		--dncTaskList.Items.Checked = false dncTaskList.SelectedItems.Item[index]
	)
 
    on listview_rollout resized rollout_size do
    (
        if rollout_size[1] <= 190 do
            listview_rollout.width = 190 --limit dialog resizing
        if rollout_size[2] <= 150 do
            listview_rollout.height = 150
 
        dncTaskList.Size = dotNetObject "System.Drawing.Size" (listview_rollout.width - 6) (listview_rollout.height - 40)
        dncTaskList.Columns.Item[1].Width = (listview_rollout.width - 24)
        --resize sloupcu
    )
 
    on listview_rollout close do
    (
        file_stream = dotNetObject dn_streamwriter (dn_file.Create file_name)
 
        item_count = listview_rollout.dncTaskList.Items.Count - 1
 
        for index = 0 to item_count do
            file_stream.WriteLine ((local list_item = listview_rollout.dncTaskList.Items.Item[index]).Checked as string + "\t" + list_item.SubItems.Item[1].Text)
 
        file_stream.Close()
        file_stream.Dispose()
        file_stream = undefined
    )
)
createDialog listview_rollout style:#(#style_titlebar, #style_sysmenu, #style_minimizebox, #style_resizing)

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

Questions?

You mentioned on your site that is says a seperate file for each user? What do you mean by that exactly?

Does the checklist save with the max file is that what you mean? if so is it a unique file for each max scene?

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

Excellent!

Excellent script SwordSlayer. Thank you very much for the script. It is better than what I could have thought of. I'm not to familiar with dotNet controls, but because of this I'm going to get into learning them.
Thanks again.
JokerMartini

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Swordslayer's picture

to-do list

Just for the fun of it, I added some bsic functionality and automatic saving of the entered tasks. You can have a look at Blog Entry :: Simple to-do list if you're interested.

Swordslayer's picture

Real-life example

This should get you started:

try destroyDialog listview_rollout catch()
rollout listview_rollout " Task List" width:200 height:300
(
	editText etTaskName "" width:75 offset:[-5,5] across:3
	button btnAdd "Add" offset:[5,3]
	button btnRemove "Remove" offset:[-5,3]
	dotNetControl dncTaskList "System.Windows.Forms.ListView" pos:[3,45] width:194 height:250
 
	local dn_listitem = dotNetClass "System.Windows.Forms.ListViewItem"
 
	on listview_rollout open do
	(
	    dncTaskList.View = (dotNetClass "System.Windows.Forms.View").Details
	    	dncTaskList.BorderStyle = dncTaskList.BorderStyle.FixedSingle
		    dncTaskList.FullRowSelect = true
		    dncTaskList.GridLines = true
			dncTaskList.CheckBoxes = true
			colums_arr = #(#(" ", 18), #("Task", 176))
			for i in colums_arr do (dncTaskList.Columns.Add i[1] i[2])
	)
 
	on btnAdd pressed do
	(
		if etTaskName.text != "" do
		(
			local new_item = dotNetObject dn_listitem ""
			new_item.SubItems.Add etTaskName.text
			new_item.Checked = false
			dncTaskList.Items.Add new_item
			new_item = undefined
		)
	)
 
	on btnRemove pressed do
	(
		selected_count = dncTaskList.SelectedItems.Count - 1
		for index = selected_count to 0 by -1 do
			dncTaskList.Items.Remove dncTaskList.SelectedItems.Item[index]
	)
)
createDialog listview_rollout
Swordslayer's picture

If it's only checklist, why

If it's only checklist, why not use .NET listview with checkboxes instead (ctrl_name.CheckBoxes = true)? I guess you're already aware of the fact that you can't add any new buttons to a rollout after you've created it (you can either predeclare given number of controls and have them hidden and only show them when needed or use .NET forms/controls, that allow this kind of behaviour).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.