eltorro Posted July 13, 2006 Share Posted July 13, 2006 How does one disable a treeviewitem?? My forum search left me empty handed. I just want to disable the first item. #include <GUIConstants.au3> $Form1 = GUICreate("Disable Treeviewitem", 242, 245, 193, 126) $TreeView1 = GUICtrlCreateTreeView(40, 24, 153, 129, BitOR($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP,$WS_BORDER), 0) $TreeView1_0 = GUICtrlCreateTreeViewItem("Item1", $TreeView1) GUICtrlCreateTreeViewItem("Item1_0", $TreeView1_0) $TreeView1_1 = GUICtrlCreateTreeViewItem("Item2", $TreeView1) $TreeView1_2 = GUICtrlCreateTreeViewItem("Item3", $TreeView1) $Button1 = GUICtrlCreateButton("Enable/Disable Item1", 40, 168, 153, 33, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Local $state = GuiCtrlRead($TreeView1_0) If BitAnd($state,$GUI_DISABLE )= $GUI_DISABLE Then GUICtrlSetState($TreeView1_0,BitOr($state,$GUI_ENABLE)) Else GUICtrlSetState($TreeView1_0,BitOr($state,$GUI_DISABLE)) EndIf EndSwitch WEnd Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
GaryFrost Posted July 13, 2006 Share Posted July 13, 2006 Not sure it can be done as of yet, Holger still hasn't implimented the Tri-State Treeview items either. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
eltorro Posted July 13, 2006 Author Share Posted July 13, 2006 Not sure it can be done as of yet, Holger still hasn't implimented the Tri-State Treeview items either.Doh! Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
evilertoaster Posted July 13, 2006 Share Posted July 13, 2006 You could do some workaround like this- #include <GUIConstants.au3> Opt("GUIonEventMode",1) $Form1 = GUICreate("Disable Treeviewitem", 242, 245, 193, 126) $TreeView1 = GUICtrlCreateTreeView(40, 24, 153, 129,0) $TreeView1_0 = GUICtrlCreateTreeViewItem("Item1", $TreeView1) GUICtrlSetOnEvent(-1,"MSH") $item_0 = GUICtrlCreateTreeViewItem("Item1_0", $TreeView1_0) $TreeView1_1 = GUICtrlCreateTreeViewItem("Item2", $TreeView1) $TreeView1_2 = GUICtrlCreateTreeViewItem("Item3", $TreeView1) $Button1 = GUICtrlCreateButton("Enable/Disable Item1", 40, 168, 153, 33, 0) GUICtrlSetOnEvent(-1,"But") GUISetOnEvent($GUI_EVENT_CLOSE,"BYE") GUISetState(@SW_SHOW) $IsDisabled=0 while 1 Sleep(1000) WEnd func MSH() if $IsDisabled=0 then MsgBox(0,"","") EndIf EndFunc Func bye() Exit EndFunc func but() if $IsDisabled=0 then GUICtrlSetColor($TreeView1_0,0x999999) $IsDisabled=1 Else GUICtrlSetColor($TreeView1_0,0x000000) $IsDisabled=0 EndIf EndFunc It's in event mode btw Link to comment Share on other sites More sharing options...
eltorro Posted July 13, 2006 Author Share Posted July 13, 2006 You could do some workaround like this- #include <GUIConstants.au3> Opt("GUIonEventMode",1) $Form1 = GUICreate("Disable Treeviewitem", 242, 245, 193, 126) $TreeView1 = GUICtrlCreateTreeView(40, 24, 153, 129,0) $TreeView1_0 = GUICtrlCreateTreeViewItem("Item1", $TreeView1) GUICtrlSetOnEvent(-1,"MSH") $item_0 = GUICtrlCreateTreeViewItem("Item1_0", $TreeView1_0) $TreeView1_1 = GUICtrlCreateTreeViewItem("Item2", $TreeView1) $TreeView1_2 = GUICtrlCreateTreeViewItem("Item3", $TreeView1) $Button1 = GUICtrlCreateButton("Enable/Disable Item1", 40, 168, 153, 33, 0) GUICtrlSetOnEvent(-1,"But") GUISetOnEvent($GUI_EVENT_CLOSE,"BYE") GUISetState(@SW_SHOW) $IsDisabled=0 while 1 Sleep(1000) WEnd func MSH() if $IsDisabled=0 then MsgBox(0,"","") EndIf EndFunc Func bye() Exit EndFunc func but() if $IsDisabled=0 then GUICtrlSetColor($TreeView1_0,0x999999) $IsDisabled=1 Else GUICtrlSetColor($TreeView1_0,0x000000) $IsDisabled=0 EndIf EndFunc It's in event mode btw Thanks for the reply, but not exactly what I am looking for. I need the checkboxes too. However, Holger has made some progress on the Tri-State treeview. Please see here. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code 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