super1337 Posted October 17, 2014 Posted October 17, 2014 Had a question that wasn't apparant to me... If you have a listview with $TVS_HASBUTTONS and $TVS_CHECKBOXES turned on, is there a way to make it so that any child items do not have checkboxes? I was hoping to have something where checkboxes could be turned on for a parent, but the child properties would have no checkbox and would just include descriptive text about the parents. Also, is there a way to force all of the child objects to be checked when the parent is checked? After reading some threads I saw a lot of people having problems with this configuration being turned on, but mine seems to be off by default. Thanks in advance!
Solution LarsJ Posted October 17, 2014 Solution Posted October 17, 2014 Do you mean a TreeView?This is the example for _GUICtrlTreeView_SetStateImageIndex modified a little bit: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Global $hStateImage Example() Func Example() Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) GUICreate("TreeView Set State Image Index", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) ;_CreateStateImageList() ;_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage) _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 0 To 9 $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1) For $y = 1 To 3 $hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y)) _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 0) $iYItem += 1 Next Next _GUICtrlTreeView_EndUpdate($hTreeView) _GUICtrlTreeView_SelectItem($hTreeView, $hItem[0]) ;_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2) MsgBox($MB_SYSTEMMODAL, "Information", "State Image Index for Item 0: " & _GUICtrlTreeView_GetStateImageIndex($hTreeView, $hItem[0])) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func _CreateStateImageList() $hStateImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3) _GUIImageList_AddIcon($hStateImage, "shell32.dll", 4) EndFunc ;==>_CreateStateImageList Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
super1337 Posted October 17, 2014 Author Posted October 17, 2014 Lars you're the man... that is exactly what I was looking for!
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