Sign in to follow this  
Followers 0
Drifter

Tab Item failure?

5 posts in this topic

#1 ·  Posted (edited)

Why does this code not work?

GUICreate("TabTest",500,500)
GUICtrlCreateTab(10,10,480,480)
GUICtrlCreateTabItem("test 1")
GUICtrlCreateButton("button",40,40,60,60)

GUICtrlCreateTabItem("test 2")

GUICtrlCreateTab(40,40,200,200)
GUICtrlCreateTabItem("tab in tab 1")
GUICtrlCreateTabItem("tab in tab 2")

GUISetState()
Sleep(10000)

The second tab menu should show up INSIDE the second tab item of the first tab menu, but instead the tabs on menu 1 are appended. Why?

Edited by Drifter

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

In the helpfile on GUICtrlCreateTab:

"ONLY one Tab control can be created by window. But a script can creates several windows having a tab in."

To get the behavior you want, create a child on the parent tab item, then create the new tab control in that child gui.

Edit: oh and the helpfile on GUICtrlCreateTabItem: "Don't forget to close your tabitem creation with GUICtrlCreateTabItem("")"

Edited by Tvern

Share this post


Link to post
Share on other sites

Seems I can't hide a tab either?

GUICtrlSetState($tabitem,$GUI_HIDE)

fails.

Share this post


Link to post
Share on other sites

There is probably a way to do it, but I don't know how to hide a tabitem.

A workaraound would be to create your tabitem in a function, so you can delete/recreate easily. You'd need to keep track of the values and states of the control in the tabitem though, so you can recreate them in their original state.

I think I'd make 3 same size arrays (or one 2D array with 3 collumns), storing the control ID's, states and values of the controls. It should be ok, as long as you have a fixed number and order of controls.

Seems a bit awkward I wonder if I am realy just missing an obvious way to hide an item.

Share this post


Link to post
Share on other sites

I think I'll just create a second gui window to handle my "top level" tab set, it works i guess ;)

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