Catdaddy Posted August 10, 2007 Share Posted August 10, 2007 Please forgive me for the noob question but I need some help with using checkboxes within a treeview. I know that you can use $TVS_CHECKBOXES to create checkboxes next to treeview items. I have a treeview who's items are populated from an .INI file. I want the user to be able to select multiple checkboxes and then be able to read only the checked items into an array. Here's kind of an example of what I'm talking about: CODE#include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 201, 253, -1, -1) $TreeView1 = GUICtrlCreateTreeView(24, 32, 153, 161, BitOR($TVS_HASBUTTONS,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) $TreeView1_0 = GUICtrlCreateTreeViewItem("Object1", $TreeView1) $TreeView1_1 = GUICtrlCreateTreeViewItem("Object2", $TreeView1) $TreeView1_2 = GUICtrlCreateTreeViewItem("Object3", $TreeView1) $TreeView1_3 = GUICtrlCreateTreeViewItem("Object4", $TreeView1) $TreeView1_4 = GUICtrlCreateTreeViewItem("Object5", $TreeView1) $TreeView1_5 = GUICtrlCreateTreeViewItem("Object6", $TreeView1) $TreeView1_6 = GUICtrlCreateTreeViewItem("Object7", $TreeView1) $Button1 = GUICtrlCreateButton("OK", 56, 208, 81, 33, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd When the user hits the OK button, I want to be able to run through the items in the treeview, and if they're checked add them to an array. Any ideas? Would greatly appreciate help. Thx. Link to comment Share on other sites More sharing options...
Gif Posted August 10, 2007 Share Posted August 10, 2007 Please forgive me for the noob question but I need some help with using checkboxes within a treeview. I know that you can use $TVS_CHECKBOXES to create checkboxes next to treeview items. I have a treeview who's items are populated from an .INI file. I want the user to be able to select multiple checkboxes and then be able to read only the checked items into an array. Here's kind of an example of what I'm talking about:CODE#include <GUIConstants.au3>$Form1 = GUICreate("AForm1", 201, 253, -1, -1)$TreeView1 = GUICtrlCreateTreeView(24, 32, 153, 161, BitOR($TVS_HASBUTTONS,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))$TreeView1_0 = GUICtrlCreateTreeViewItem("Object1", $TreeView1)$TreeView1_1 = GUICtrlCreateTreeViewItem("Object2", $TreeView1)$TreeView1_2 = GUICtrlCreateTreeViewItem("Object3", $TreeView1)$TreeView1_3 = GUICtrlCreateTreeViewItem("Object4", $TreeView1)$TreeView1_4 = GUICtrlCreateTreeViewItem("Object5", $TreeView1)$TreeView1_5 = GUICtrlCreateTreeViewItem("Object6", $TreeView1)$TreeView1_6 = GUICtrlCreateTreeViewItem("Object7", $TreeView1)$Button1 = GUICtrlCreateButton("OK", 56, 208, 81, 33, 0)GUISetState(@SW_SHOW)While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitchWEndWhen the user hits the OK button, I want to be able to run through the items in the treeview, and if they're checked add them to an array. Any ideas? Would greatly appreciate help. Thx.this can only be done using Au3Lib, use _TreeView_GetChecked() to check for checked items Link to comment Share on other sites More sharing options...
Catdaddy Posted August 11, 2007 Author Share Posted August 11, 2007 Thanks, Gif. 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