this-is-me Posted October 11, 2004 Share Posted October 11, 2004 Sorry if this has been asked before. I know others have tried, but is there a way to have a dynamically loaded list of checkboxes that can scroll. What I want to do is present the user with a list of files in a directory and heve them uncheck the ones they don't need. Those unchecked items will be deleted. Is this possible? Who else would I be? Link to comment Share on other sites More sharing options...
Holger Posted October 11, 2004 Share Posted October 11, 2004 Did you try a treeview control with "TVS_CHECKBOXES"-style? Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
CyberSlug Posted October 11, 2004 Share Posted October 11, 2004 An example: Global $TVS_CHECKBOXES = 0x100 GuiCreate("Example") $tv = GuiCtrlCreateTreeView(10, 10, 200, 200, $TVS_CHECKBOXES) GUICtrlCreateTreeViewItem("one", $tv) GUICtrlCreateTreeViewItem("two", $tv) GUICtrlCreateTreeViewItem("three", $tv) GuiSetState() While GuiGetMsg() <> -3 Wend Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
this-is-me Posted October 11, 2004 Author Share Posted October 11, 2004 Thanks a lot, but two silly questions here... How do I set the state of a treeview item to hidden (or delete it), and does the treeview item only fire an event if it is checked, but not when it is unchecked? Who else would I be? Link to comment Share on other sites More sharing options...
CyberSlug Posted October 11, 2004 Share Posted October 11, 2004 (edited) Hope this helps: GuiCreate("Example") $tv = GuiCtrlCreateTreeView(10, 10, 200, 200, 0x100);$TVS_CHECKBOXES Dim $box[11] For $i = 1 to 10 $box[$i] = GUICtrlCreateTreeViewItem("item_" & $i, $tv) Next GuiCtrlDelete($box[2]) GuiCtrlDelete($box[4]) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = -3 Then ExitLoop If $msg >= $box[1] and $msg <= $box[9] Then ToolTip("Click Detected " & $msg-3);minus 3 due to offset because 1 <> $box[1] sleep(500) ToolTip('') EndIf Wend $t = "" For $i = 1 to 10 If GuiRead($box[$i]) = 1 Then $t = $t & " " & $i ;FYI, if an item had been deleted, GuiRead returns 1243832 Next MsgBox(4096, "Info", "The following items are checked: " & $t) Edited October 11, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
awrog Posted January 4, 2005 Share Posted January 4, 2005 Cyberslug,Very interesting example!But can you tell me why $t does not contain the last checked checkbox when I close the window? Is it a bug?Kind regards,Arno RogHope this helps:GuiCreate("Example") $tv = GuiCtrlCreateTreeView(10, 10, 200, 200, 0x100);$TVS_CHECKBOXES Dim $box[11] For $i = 1 to 10 $box[$i] = GUICtrlCreateTreeViewItem("item_" & $i, $tv) Next GuiCtrlDelete($box[2]) GuiCtrlDelete($box[4]) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = -3 Then ExitLoop If $msg >= $box[1] and $msg <= $box[9] Then ToolTip("Click Detected " & $msg-3);minus 3 due to offset because 1 <> $box[1] sleep(500) ToolTip('') EndIf Wend $t = "" For $i = 1 to 10 If GuiRead($box[$i]) = 1 Then $t = $t & " " & $i ;FYI, if an item had been deleted, GuiRead returns 1243832 Next MsgBox(4096, "Info", "The following items are checked: " & $t)<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Holger Posted January 4, 2005 Share Posted January 4, 2005 (edited) @awrog: only a scripting bug Please replace the line: If GuiRead($box[$i]) = 1 Then $t = $t & " " & $i with this: If BitAnd(GuiCtrlRead($box[$i]),1) Then $t = $t & " " & $i This is because of the latest item you have clicked -> this is then in 'selected' state -> and so GUICtrlRead returns 1 + 256 (GUI_CHECKED + GUI_FOCUS). Also in the new beta version the GUIRead ist replaced by GUICtrlRead. So long... Edited January 4, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
awrog Posted January 4, 2005 Share Posted January 4, 2005 Holger,I dont know how you guys (guis )do it , but it works.Compliments about this support-forum, it surpasses everything I know!Arno Rog@awrog: only a scripting bug Please replace the line:If GuiRead($box[$i]) = 1 Then $t = $t & " " & $iwith this:If BitAnd(GuiCtrlRead($box[$i]),1) Then $t = $t & " " & $iThis is because of the latest item you have clicked -> this is then in 'selected' state -> and so GUICtrlRead returns 1 + 256 (GUI_CHECKED + GUI_FOCUS).Also in the new beta version the GUIRead ist replaced by GUICtrlRead.So long... <{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Holger Posted January 4, 2005 Share Posted January 4, 2005 (edited) @awrog: this is cause I'm one of the developer of this treeview-thing Edited January 4, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now