Jump to content

Strange GUI behaviour while using tab items

Recommended Posts



I'm stuck and in need of some explanation.

#include <GUIConstantsEx.au3>

Global $gsa_GUI = GUICreate("GUI", 300, 250)

$Tab = GUICtrlCreateTab(20, 20)
$TabItem1 = GUICtrlCreateTabItem("Tab1")

$Graphic1 = GUICtrlCreateGraphic(30, 50, 200, 100)
GUICtrlSetColor(-1, 0x000000)

$TabItem2 = GUICtrlCreateTabItem("Tab2")

$Button1 = GUICtrlCreateButton("Hide graphic", 20, 180, 150)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            GUICtrlSetState($Graphic1, $GUI_HIDE)

Running this script brings up a GUI I made in order to demonste my problem.

First of all, the rectangle created with GUICtrlCreateGraphic() is somehow behind the tab item, although it seems to counts as created on it, which you can see by switching to Tab2.

Clicking the "Hide graphic" button should actually make the rectangle disappear completely, but it doesn't.

Instead the behavior is like this:

  • Clicking the button while Tab1 is active makes the rectangle to appear on all tabs.
  • Clicking the button while Tab2 is active makes the rectangle disappear on every tab.


Can someone explain?
How can I correctly control visibility of controls on my tab items?
How can I make stuff like graphics appear on the tab instead of behind it?

For the last one it seems like using

GUICtrlSetState($Graphic1, $GUI_ONTOP)

is the way to go.

Edited by Radiance

Share this post

Link to post
Share on other sites

A bit of more explanation:

I've got a big GUI with two groups, each containing a massive amount of GUI controls.
Clicking a button makes one group invisible and the other one visible.

Now using tabs would be the perfect choice since the change appears instantly.

Looping through each group using $GUI_HIDE / $GUI_SHOW is possible too but takes long enough to make it look really ugly.

Edited by Radiance

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