Jump to content
Sign in to follow this  

Treeview expand

Recommended Posts

I tried GuiCtrlSetState with every state and none expanded the treeview item.

Here's my script.

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

;Only a close button:
;GUICreate("New GUI", $GUIWidth, $GUIHeight, -1, -1, $style1)

GUICreate("Settings", $GUIWidth, $GUIHeight)

$TreeView = GUICtrlCreateTreeView(10, 10, 100, 150)
$Settings_treeview = GUICtrlCreateTreeViewItem("Settings", $TreeView)
   $General_TV_menuitem = GUICtrlCreateTreeViewItem("General", $Settings_treeview)
   $Tools_TV_menuitem = GUICtrlCreateTreeViewItem("Tools", $Settings_treeview)


Dim $state[14]
$state[0] = 0
$state[1] = $GUI_UNCHECKED
$state[2] = $GUI_CHECKED
$state[4] = $GUI_AVISTART
$state[5] = $GUI_AVISTOP
$state[6] = $GUI_AVICLOSE
$state[7] = $GUI_ACCEPTFILES
$state[8] = $GUI_SHOW
$state[9] = $GUI_HIDE
$state[10] = $GUI_ENABLE
$state[11] = $GUI_DISABLE
$state[12] = $GUI_FOCUS
$state[13] = $GUI_DEFBUTTON

For $i = 0 To 13
   GUICtrlSetState($Settings_treeview, $state[$i])
   ToolTip("state number: " & $i + 1)

While 1
   $msg = GUIGetMsg()
      Case $msg = $GUI_EVENT_CLOSE

     ;Case $msg = ...



Share this post

Link to post
Share on other sites

Allright that works.

I think that GUIRead doesn't work well with the treeview control.

When I use it with the control itself, it returns me nothing.

When I click on a treeviewitem, GUIRead returns 256 for every treeviewitem.

What I noticed: when you select something and press a button, the selection disappears.

Maybe that's why it keeps returning 256.

I'll attach the script, so you can have a look.

When you press the OK button, it shows the values GUIRead() returns.

Share this post

Link to post
Share on other sites

Try checking the return value of GuiGetMsg....

For debugging, you could add this line right after $msg = GUIGetMsg():

If $msg > 0 Then ToolTip("Last Message: " & $msg, 0, 0)

I believe the highlighting of the selection just indicates what control has focus. After you select an item, try pressing the Tab key 3 or 4 times.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post

Link to post
Share on other sites

@SlimShady: I sent a change to Jon (who is a little bit busy at the moment you know) to add/force as default style for a treeview - the "TVS_SHOWSELALWAYS".

So at the moment you have to use something like:


Then the selected item will have a selection-rectangle over it.

!!! BUT NOT THE FOCUS -> cause the focus is now on the button you know !!!

Ahhh, forgot - the changes I have sent alos included a change/addition to the read-function, so GUIRead(treeview) would return the currently selected item.

256 on a treeviewitem means $GUI_FOCUS.

But there is maybe like you said an error in the GUIRead() - I check this now...

So long :)


Edited by Holger

Share this post

Link to post
Share on other sites

Oh shit ;) a completely bug thing I have did - I found the problem... it's so stupid ... ok, I will correct it and send the change to JON and JP :)


@Jon/JP: if you read this: I will send you the changes lately on saturday evening, I feel a little bit blue now - have to take a break and on saturday I have to work too, thatswhy :)

Regards Holger

Edited by Holger

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...