dexto Posted October 11, 2008 Share Posted October 11, 2008 Trying to figgure out what woud be the best way to run given function when item in the TreeView got checked (unchecked) Way #1: Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"UpdateChecked") Way #2 While True $csel = _GUICtrlTreeView_GetSelection($Tree) If $csel <> $osel Then $osel = $csel updateinfo($csel) EndIf sleep(50) Wend FUNCTION: Func UpdateChecked() Local $idx $idx = _GUICtrlTreeView_GetSelection($Tree) If _GUICtrlTreeView_Level($Tree, $idx) = 0 Then If _GUICtrlTreeView_GetChecked($Tree, $idx) Then ;selcted Checked Else ;selcted Unchecked EndIf EndIf EndFunc ;==>UpdateChecked Any other ways...? In first case for every click function will update LVL 0 Item if it is selected - bad idea in my program. In second case any change in item selected will tiger the function - bad idea 2... help... Link to comment Share on other sites More sharing options...
dexto Posted October 11, 2008 Author Share Posted October 11, 2008 Anyone has any ideas about this? That might help me to turn them into a code.. So far I'm running function on every click. (problem with that its not stable because while click happens fiction ruining BEFORE the item is checked(as AutoIT reports). So it considers it unchecked) Link to comment Share on other sites More sharing options...
dexto Posted October 11, 2008 Author Share Posted October 11, 2008 How about this? What is it doing? $Tree = GUICtrlCreateTreeView(8, 5, 204, 587, BitOR($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES,$WS_GROUP,$WS_TABSTOP,$WS_VSCROLL)) GUICtrlSetOnEvent(-1, "UpdateChecked") 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