Sign in to follow this  
Followers 0
wodzuu

ctrlgetstate strange problem

8 posts in this topic

#1 ·  Posted (edited)

Hi,

I have gui made with AutoIt

Dim $handles[1]
...
$treeview = GUICtrlCreateTreeView (10,125,270,275,BitOr($TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_CHECKBOXES),$WS_EX_CLIENTEDGE)
...
_ArrayAdd( $handles,GUICtrlCreateTreeViewitem ($file,$treeview))
...

and I have a problem that both:

GUICtrlSetState ($handles[$i], $GUI_CHECKED)
                MsgBox(0,"",GUICtrlGetState($handles[$i]))

and

GUICtrlSetState ($handles[$i], $GUI_UNCHECKED)
                MsgBox(0,"",GUICtrlGetState($handles[$i]))

Show me MessageBox with magic number 80. I need this to check in other part of my code which elements of tree are checked.

Anyone can help ?

Thanks in advance :D

Edited by wodzuu

Share this post


Link to post
Share on other sites



Show me MessageBox with magic number 80. I need this to check in other part of my code which elements of tree are checked.

see GUIConstants.au3 in AutoIT include dir.

80 = 64 + 16 = $GUI_ENABLE + $GUI_SHOW

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

see GUIConstants.au3 in AutoIT include dir.

80 = 64 + 16 = $GUI_ENABLE + $GUI_SHOW

Cheers

Kurt

So number 80 doesn't provide any information about wheter it's checked or not :D Do yo know how to check it ?

I understand that I should expect 81 or 84

Edited by wodzuu

Share this post


Link to post
Share on other sites

So number 80 doesn't provide any information about wheter it's checked or not :D Do yo know how to check it ?

I understand that I should expect 81 or 84

actually I don't know what exactly you want to check.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

actually I don't know what exactly you want to check.

Cheers

Kurt

I wan to do something (if statement) when one of treeViewItem's has state $GUI_CHECKED.

I do it in a loop:

For $i = 1 to $items Step 1
        if (GUICtrlGetState($handles[$i]) == $GUI_CHECKED) then
        ;-----loop
        endif
    Next

where $items is a number of items in a treeView, $handles is an array of Control ID's of that items (_ArrayAdd( $handles,GUICtrlCreateTreeViewitem ($file,$treeview)))

that's all :D

Share this post


Link to post
Share on other sites

where $items is a number of items in a treeView, $handles is an array of Control ID's of that items (_ArrayAdd( $handles,GUICtrlCreateTreeViewitem ($file,$treeview)))

that's all :D

Ah, O.K. then take a look at the help file example for GUICtrlCreateTreeViewItem(). There you will find what you are looking for. Its the code after "Case $msg = $infobutton".

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Ah, O.K. then take a look at the help file example for GUICtrlCreateTreeViewItem(). There you will find what you are looking for. Its the code after "Case $msg = $infobutton".

Cheers

Kurt

Thanks for your reply but I cant find in that example code "Case $msg = $infobutton". That's strange. Maybe you have different help file ? Can you paste that example for me here ?

Share this post


Link to post
Share on other sites

Thanks for your reply but I cant find in that example code "Case $msg = $infobutton". That's strange. Maybe you have different help file ? Can you paste that example for me here ?

You are right. It's in the help file of the beta version. Maybe you should install the latest beta and play with the whole example, not just the few lines below.

Case $msg = $infobutton

$item = GUICtrlRead($treeview) ; Get the controlID of the current selected treeview item

If $item = 0 Then

MsgBox(64, "TreeView Demo", "No item currently selected")

Else

$advmsg = GUICtrlRead($item, 1) ; Get advanced infos about the treeview item

If ($advmsg[0]== 0) Then

MsgBox(16, "Error", "Error while retrieving infos about item")

Else

MsgBox(64, "TreeView Demo", "Current item selected is: " & $advmsg[0]) ; $advmsg[0] contains the text and $advmsg[1] the state value of the treeview item

EndIf

EndIf

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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