Sign in to follow this  
Followers 0
dexto

_GUICtrlTreeView detect item checked event?

3 posts in this topic

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...

:P

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0