ioctl Posted July 5, 2005 Posted July 5, 2005 (edited) First a description of my problem :I have a treeview with subitems.Test1------Programs1------------------Mspaint.exe------------------Calc.exe------------------Notepad.exe------------------Cmd.exe------Programs2------Programs3Test2Test3When i check all programs automatically it works ok! The programs running...But if i check it manually with my mouse cannot recognize that the GUICtrlCreateTreeViewItem is Checked!If i use GUICtrlSetState(-1, $GUI_CHECKED) then it works again.Iam doing something wrong or its a bug of GUI?(If i use GuiCtrlCreateCheckbox i dont have any problems)Here is the code to understand better.Thanks in advance for anyone to help!#include <GuiConstants.au3>; GUIGUICreate("Test - ATK",530,400,-1,-1,BitOr($WS_MINIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))GuiSetIcon(@SystemDir & "\mobsync.exe", 0);Buttons$Test = GuiCtrlCreateButton("Test Selected", 415, 210, 100, 20)$Button_Checkall = GuiCtrlCreateButton("Check All", 415, 260, 100, 20)$Button_Clearall = GuiCtrlCreateButton("Clear All", 415, 285, 100, 20)$Settings = GUICtrlCreateButton ("Settings", 415, 235, 100, 20)$Exit = GUICtrlCreateButton ("Exit", 415, 310, 100, 20)Dim $Icon[39],$Checkbox[39],$Label[39],$Installs[39]$Icon[0] = 38$Checkbox[0] = 38$Label[0] = 38$Installs[0] = 38;INSTALLS$Installs[1] = "mspaint.exe"$Installs[2] = "calc.exe"$Installs[3] = "notepad.exe"$Installs[4] = "cmd.exe"$maingroup = GUICtrlCreateGroup ("Select your mode",5,10,180,195)$maintree = GUICtrlCreateTreeView (15,30,160,165,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)$treeItem1 = GuiCtrlCreateTreeViewItem("Test1", $maintree)$treeItem2 = GuiCtrlCreateTreeViewItem("Test2", $maintree)$treeItem3 = GuiCtrlCreateTreeViewItem("Test3", $maintree)$OPEN_PROGRAMS = GuiCtrlCreateTreeViewItem("Programs1", $treeItem1)$OPEN_WEP64 = GuiCtrlCreateTreeViewItem("Programs2", $treeItem1)$OPEN_WEP128 = GuiCtrlCreateTreeViewItem("Programs3", $treeItem1);EMPTY BOX$EMPTY_GROUP = GUICtrlCreateGroup ("",198,10,328,195)$EMPTY_TREE = GUICtrlCreateTreeView (208,30,310,165,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE);PROGRAMS1$PROGRAMS_GROUP = GUICtrlCreateGroup ("Programs1",198,10,328,195)GUICtrlSetState (-1,$GUI_HIDE)$PROGRAMS_TREE = GUICtrlCreateTreeView (208,30,310,165,BitOr($TVS_HASBUTTONS,$TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)GUICtrlSetState (-1,$GUI_HIDE)$Checkbox[1] = GUICtrlCreateTreeViewItem("MsPaint",$PROGRAMS_TREE)$Checkbox[2] = GUICtrlCreateTreeViewItem ("Calc",$PROGRAMS_TREE)$Checkbox[3] = GUICtrlCreateTreeViewItem ("Notepad",$PROGRAMS_TREE)$Checkbox[4] = GUICtrlCreateTreeViewItem ("Command",$PROGRAMS_TREE); GUI MESSAGE LOOPGuiSetState()While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Exit ExitLoop Case $msg = $treeItem1 GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE) GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE) GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW) GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW) Case $msg = $OPEN_PROGRAMS GUIctrlSetState ($EMPTY_GROUP,$GUI_HIDE) GUIctrlSetState ($EMPTY_TREE,$GUI_HIDE) GUIctrlSetState ($PROGRAMS_GROUP,$GUI_SHOW) GUIctrlSetState ($PROGRAMS_TREE,$GUI_SHOW) Case $msg = $treeItem2 GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE) GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE) GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW) GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW) Case $msg = $treeItem3 GUIctrlSetState ($PROGRAMS_GROUP,$GUI_HIDE) GUIctrlSetState ($PROGRAMS_TREE,$GUI_HIDE) GUIctrlSetState ($EMPTY_GROUP,$GUI_SHOW) GUIctrlSetState ($EMPTY_TREE,$GUI_SHOW) ; CHECK ALL BOXES Case $msg = $Button_Checkall GUICtrlSetState($Checkbox[1], $GUI_CHECKED) GUICtrlSetState($Checkbox[2], $GUI_CHECKED) GUICtrlSetState($Checkbox[3], $GUI_CHECKED) GUICtrlSetState($Checkbox[4], $GUI_CHECKED); CLEAR ALL BOXES Case $msg = $Button_Clearall GUICtrlSetState($Checkbox[1], $GUI_UNCHECKED) GUICtrlSetState($Checkbox[2], $GUI_UNCHECKED) GUICtrlSetState($Checkbox[3], $GUI_UNCHECKED) GUICtrlSetState($Checkbox[4], $GUI_UNCHECKED) Case $msg = $Test for $i = 1 to $CheckBox[0] If (GUICtrlRead($CheckBox[$i]) == $GUI_CHECKED) Then RunWait($Installs[$i]) Next Case Else EndSelectWEndExit Edited July 5, 2005 by ioctl
GaryFrost Posted July 5, 2005 Posted July 5, 2005 I posted bug report for this behaviour. Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
ioctl Posted July 5, 2005 Author Posted July 5, 2005 Thanks Gary. If you have any sollution post it please.
Holger Posted July 5, 2005 Posted July 5, 2005 Bug report is wrong cause it's not a bug.Replace your line:If (GUICtrlRead($CheckBox[$i]) == $GUI_CHECKED) Then RunWait($Installs[$i])with this:If (BitAnd(GUICtrlRead($CheckBox[$i]),$GUI_CHECKED)) Then RunWait($Installs[$i])For your info: The last focused item also has the state $GUI_FOCUS so you have to check it only against $GUI_CHECKED with BitAnd()RegardsHolger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
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