spudw2k Posted August 24, 2007 Posted August 24, 2007 (edited) -changed listview to treeview (my bad) So I was having difficulties using the checkboxes in a treeview. I saw several posts that pointed to AU3lib. AU3lib is cool, and has some very neat-useful stuff but I did not like how it was handling my treeview (not to mention I couldn't get it to work). Here's some code that works with a treeview (w/ checkboxes) without using AU3lib. expandcollapse popup#include <GuiTreeView.au3> #include <Array.au3> $arrComputers = _ArrayCreate("localhost","server1","workstation1","server2","workstation2") $tGui = GUICreate("Computers in Domain",250,300,-1,-1) $tFileMenu = GUICtrlCreateMenu("&Edit") $tSelectAll = GUICtrlCreateMenuItem("Select All" & @TAB & "CTRL + A",$tFileMenu) $tDeSelectAll = GUICtrlCreateMenuItem("DeSelect All" & @TAB & "CTRL + D",$tFileMenu) $tTree = GUICtrlCreateTreeView(5,5,240,240,$TVS_CHECKBOXES) Dim $tTreeArr[1] For $i = 0 to UBound($arrComputers) - 1 $tTreeArr[$i] = GUICtrlCreateTreeViewItem($arrComputers[$i],$tTree) ReDim $tTreeArr[$i + 2] Next GUISetState(@SW_SHOW,$tGui) While 1 $msg = GUIGetMsg() If $msg = $tSelectAll Then For $i = 0 to _GUICtrlTreeView_GetCount($tTree) - 1 GUICtrlSetState($tTreeArr[$i],$GUI_CHECKED) Next EndIf If $msg = $tDeSelectAll Then For $i = 0 to _GUICtrlTreeView_GetCount($tTree) - 1 GUICtrlSetState($tTreeArr[$i],$GUI_UNCHECKED) Next EndIf ;BitAnd(GUICtrlRead($tTreeArr[$i]),$GUI_CHECKED)) How to determine if checkbox is checked If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Update: Changed getcount method to reflect new version of AutoIt 3.2.10.0 Edited April 7, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
GaryFrost Posted August 24, 2007 Posted August 24, 2007 where was listview used in the script? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
spudw2k Posted August 24, 2007 Author Posted August 24, 2007 Whoops, I meant treeview. Doh! Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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