Page 1 of 1

TabControl and TabPane

Posted: Tue Jul 19, 2005 19:05
by EJohnson
Howdy. So I'm trying to get the Tab widget working in my app, but having trouble getting widgets to display *in* the TabPanes.


I'm under the assumption I should:
1) Create a TabControl
2) Create TabPanes, calling TabControl->addTab()
3) Create widgets and add them to each TabPane by TabPane->addChildWindow()

The TabControl and TabPanes are being displayed okay, but the widgets in each tab are not. Am I missing something?


Second Question:
The TabControl->addTab() method takes in a Window*, not a TabPane*. Is there a reason for that? Can a TabControl really accept any type of Window?

Thanks for any tips!

Re: TabControl and TabPane

Posted: Wed Jul 20, 2005 08:35
by CrazyEddie
Hi,

You do not need to create the TabPane yourself.

The advised way to do this is to layout your content for each pane on a DeafultWindow, and then simply add the DefaultWindow containing the widgets to the TabControl using the usual addChildWindow method. This will create a new pane within the tab control widget. The name button for the pane is taken from the window that you add (so in this example use setText on the DefaultWindow containing the widgets to whatever you want the button label to be).

Re: TabControl and TabPane

Posted: Thu Jul 21, 2005 00:00
by EJohnson
That's the ticket!

1) Create a TabControl
2) Create a DefaultWindow
3) defaultWindow->setText("tab name");
4) Add Windows to the DefaultWindow
5) TabControl->addChildWindow( defaultWindow )
6) repeat as required.

Thanks!