Wooltown Posted June 10, 2005 Posted June 10, 2005 It works fine to checkmark/uncheckmark checkboxes with Spacebar, thank you, but is the intention that the checkboxes should be checkmarked/uncheckmarked by just going up and down using the arrows ? - If so how can I detect in what way the checkbox is being checkmarked/uncheckmarked ? - If made by just using the arrows/spacebar/mouseclick ? Hopefully you undestand how I mean. Regards Sven
jpm Posted June 10, 2005 Posted June 10, 2005 It works fine to checkmark/uncheckmark checkboxes with Spacebar, thank you, but is the intention that the checkboxes should be checkmarked/uncheckmarked by just going up and down using the arrows ? - If so how can I detect in what way the checkbox is being checkmarked/uncheckmarked ? - If made by just using the arrows/spacebar/mouseclick ?Hopefully you undestand how I mean.RegardsSven<{POST_SNAPBACK}>That's does not look to good. I hope Holger will comment.
Holger Posted June 10, 2005 Posted June 10, 2005 @Wooltown: Sorry, I couldn't completely understand what you mean. Why is the kind of the checkboxes are checked/unchecked important? Normally the item will checked/unchecked only if you press space or click on it. If the check/uncheck with using the arrows then you may have a bug in your script cause I checked the behaviour under Win95/98/NT4/2000 and XP We have only one possibility for returning an event: GuiGetMsg() Or with using GuiCtrlSetOnEvent(). But I see no problem at the moment... So long... Holger P.S.: maybe I didn't understand you the right way, if so then please send me your script or the standalone _working_ part of your script which makes the problem Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Wooltown Posted June 13, 2005 Author Posted June 13, 2005 A small misstake when I answeded you, the Code you sent me, I just added a MessageBox, the checkmar/uncheckmark works fine, but when I go up and down using the arrows, it will trigger the Event, and I'm using the event to build an array of what tests to run during the night, so I dont't what AutoIt to react with an event when ust going up and down using the arrow keys.'RegardsSven#include <GUIConstants.au3>Opt("GUIOnEventMode",1)GUICreate("test")$treeview = GUICtrlCreateTreeView (6,6,300,434,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$TVS_TRACKSELECT ),$WS_EX_CLIENTEDGE )$item1 = GUICtrlCreateTreeViewItem("Item1",$treeview)GUICtrlSetOnEvent(-1,"ItemSelection")$item2 = GUICtrlCreateTreeViewItem("Item2",$treeview)GUICtrlSetOnEvent(-1,"ItemSelection")$item3 = GUICtrlCreateTreeViewItem("Item3",$treeview)GUICtrlSetOnEvent(-1,"ItemSelection")$item4 = GUICtrlCreateTreeViewItem("Item4",$treeview)GUICtrlSetOnEvent(-1,"ItemSelection")$subitem1 = GUICtrlCreateTreeViewItem("SubItem1",$item1)GUICtrlSetOnEvent(-1,"ItemSelection")$subitem2 = GUICtrlCreateTreeViewItem("SubItem2",$item1)GUICtrlSetOnEvent(-1,"ItemSelection")$status = GUICtrlCreateLabel("0",350,10,50,20)GUISetOnEvent($GUI_EVENT_CLOSE,"ExitGUI")GUISetState()While 1 Sleep(10)WEndExitFunc ItemSelection() GUICtrlSetData($status,@GUI_CtrlId) Msgbox(0,"Event",@GUI_CtrlId,1)EndFuncFunc ExitGUI() ExitEndFunc
Wooltown Posted June 16, 2005 Author Posted June 16, 2005 Is the above suggestion about when to trigger an Event OK to implement ? Regards Sven
Holger Posted June 16, 2005 Posted June 16, 2005 I don't understand it completely. But what about just checking the state of the item and then add it i.e. to an array and then later check out this array. Or maybe something like: #include <GUIConstants.au3> Opt("GUIOnEventMode",1) GUICreate("test") $treeview = GUICtrlCreateTreeView (6,6,300,434,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$TVS_TRACKSELECT ),$WS_EX_CLIENTEDGE ) $item1 = GUICtrlCreateTreeViewItem("Item1",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $item2 = GUICtrlCreateTreeViewItem("Item2",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $item3 = GUICtrlCreateTreeViewItem("Item3",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $item4 = GUICtrlCreateTreeViewItem("Item4",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $subitem1 = GUICtrlCreateTreeViewItem("SubItem1",$item1) GUICtrlSetOnEvent(-1,"ItemSelection") $subitem2 = GUICtrlCreateTreeViewItem("SubItem2",$item1) GUICtrlSetOnEvent(-1,"ItemSelection") $status = GUICtrlCreateLabel("0",350,10,50,20) GUISetOnEvent($GUI_EVENT_CLOSE,"ExitGUI") GUISetState() While 1 Sleep(10) WEnd Exit Func ItemSelection() GUICtrlSetData($status,@GUI_CtrlId) If BitAnd($GUI_CHECKED,GUICtrlRead(@GUI_CtrlId)) Then Msgbox(0,"Event",@GUI_CtrlId,1) EndFunc Func ExitGUI() Exit EndFunc Regards Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Holger Posted June 16, 2005 Posted June 16, 2005 (edited) @Larry: yeah, thats by design: For instance: go to your "ControlPanel", choose "Add/Remove Programs" then "Add/Remove Windows components" (have XP in German, so I don't know the right descriptions) and then just move with the arrow keys up and down. Do you see a changing description? So I absolutely see no problem here but a scripting thing. So why not just selecting all things first and then maybe with a "Next"-button read these information out... So long... Holger like i.e.: expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode",1) GUICreate("test") $treeview = GUICtrlCreateTreeView (6,6,300,334,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$TVS_TRACKSELECT ),$WS_EX_CLIENTEDGE ) $item1 = GUICtrlCreateTreeViewItem("Item1",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $startitem = $item1 $item2 = GUICtrlCreateTreeViewItem("Item2",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $item3 = GUICtrlCreateTreeViewItem("Item3",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $item4 = GUICtrlCreateTreeViewItem("Item4",$treeview) GUICtrlSetOnEvent(-1,"ItemSelection") $subitem1 = GUICtrlCreateTreeViewItem("SubItem1",$item1) GUICtrlSetOnEvent(-1,"ItemSelection") $subitem2 = GUICtrlCreateTreeViewItem("SubItem2",$item1) GUICtrlSetOnEvent(-1,"ItemSelection") $enditem = $subitem2 $status = GUICtrlCreateLabel("0",350,10,50,20) $next = GUICtrlCreateButton("Next",70,350,70,20) GUICtrlSetOnEvent(-1,"NextStep") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitGUI") GUISetState() While 1 Sleep(10) WEnd Exit Func ItemSelection() GUICtrlSetData($status,@GUI_CtrlId) EndFunc Func ExitGUI() Exit EndFunc Func NextStep() $itemtext = "" For $i = $startitem To $enditem If BitAnd(GUICtrlRead($i),$GUI_CHECKED) Then $iteminfo = GUICtrlRead($i,1) If IsArray($iteminfo) Then $itemtext = $itemtext & $iteminfo[0] & @LF EndIf Next If $itemtext <> "" Then Msgbox(0,"Items checked",$itemtext) EndFunc Edited June 16, 2005 by Holger 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