Jump to content

is it possible to hide and unhide a treeview?

Recommended Posts



i have 2 tabs setup and i would like the treeview to show up under just one tab but it shows up on both.  i take it this doesn't work because a treeview is not a control?

$current_tab = GUICtrlRead($tabs)

    If $current_tab = 0 Then
        GUICtrlSetState($scan_treeview, $GUI_SHOW)

    If $current_tab = 1 Then
        GUICtrlSetState($scan_treeview, $GUI_HIDE)

i really would like to avoid destroying it and re-creating it because id like to keep all the values there.

thank you in advance!

Share this post

Link to post
Share on other sites

A treeview seems to have the same behaviour than another control with tabs :

#include <GUIConstantsEx.au3>

GUICreate("GUI", 180, 180)

GUICtrlCreateTab(10, 10, 150, 150)
GUICtrlCreateTabItem("First tab")

Local $idTreeview = GUICtrlCreateTreeView(50, 50, 100, 100)
GUICtrlCreateTreeViewItem("Item 1", $idTreeview)
GUICtrlCreateTreeViewItem("Item 2", $idTreeview)

GUICtrlCreateTabItem("Second tab")


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


You have to create the tab control at the good place in the script

Edited by jguinch

Share this post

Link to post
Share on other sites

looks like if i create the treeview with _GUICtrlTreeView_Create (which is what i was doing) it doesnt work but if i use GUICtrlCreateTreeView then it works.

thanks =)

Edited by gcue

Share this post

Link to post
Share on other sites

I suspect that is because GUICtlSetState is expecting an AutoIT control id and not a control handle (returned by _GUICtlTreeView_Create). 

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.