Home » U++ Library support » TabCtrl » A few questions regarding TabCtrl
A few questions regarding TabCtrl [message #36744] |
Sat, 30 June 2012 17:19 ![Go to next message Go to next message](theme/default/images/down.png) |
lectus
Messages: 329 Registered: September 2006 Location: Brazil
|
Senior Member |
|
|
Hello!
1) How do I use the same layout (created by Layout editor) to create multiple tabs?
* I tried tabctrl.Add(tab) but it only shows the contents 1 time, then I get empty tabs.
2) How do I add a close button to the tabs similar to what TheIde does?
Thanks
|
|
|
Re: A few questions regarding TabCtrl [message #36746 is a reply to message #36744] |
Sat, 30 June 2012 21:07 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
|
lectus wrote on Sat, 30 June 2012 11:19 | 2) How do I add a close button to the tabs similar to what TheIde does?
|
You don't TabCtrl doesn't have such a feature. TheIde uses TabBar control. TabBar if far more advanced. You can add not only a close button but whatever you want. The goal was to integrate TabBar with TabCtrl but as usual there was something more important to do. But that would allow to have tabs on any side (not only on the top), one could also change tab position simply by dragging it.
Unfortunately this is still on to do list ![Smile](images/smiley_icons/icon_smile.gif)
PS: It's quite easy to emulate tabctrl behavior with TabBar. Simply switch views on tab change event.
|
|
|
Re: A few questions regarding TabCtrl [message #36748 is a reply to message #36744] |
Sun, 01 July 2012 18:39 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
|
lectus wrote on Sat, 30 June 2012 17:19 | 1) How do I use the same layout (created by Layout editor) to create multiple tabs?
* I tried tabctrl.Add(tab) but it only shows the contents 1 time, then I get empty tabs.
|
Each widget can be added only once. Second call of Add() removes Ctrl from its previous parent before adding to a new one. This applies to all Ctrls, not only tabs. If you want to have the same thing in two locations, you have to create two instances of it. E.g.:WithMyLayout<ParentCtrl> tab1;
WithMyLayout<ParentCtrl> tab1;
tabctrl.Add(tab1);
tabctrl.Add(tab2);
Best regards,
Honza
|
|
|
Re: A few questions regarding TabCtrl [message #36751 is a reply to message #36748] |
Mon, 02 July 2012 04:15 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
lectus
Messages: 329 Registered: September 2006 Location: Brazil
|
Senior Member |
|
|
dolik.rce wrote on Sun, 01 July 2012 12:39 |
lectus wrote on Sat, 30 June 2012 17:19 | 1) How do I use the same layout (created by Layout editor) to create multiple tabs?
* I tried tabctrl.Add(tab) but it only shows the contents 1 time, then I get empty tabs.
|
Each widget can be added only once. Second call of Add() removes Ctrl from its previous parent before adding to a new one. This applies to all Ctrls, not only tabs. If you want to have the same thing in two locations, you have to create two instances of it. E.g.:WithMyLayout<ParentCtrl> tab1;
WithMyLayout<ParentCtrl> tab1;
tabctrl.Add(tab1);
tabctrl.Add(tab2);
Best regards,
Honza
|
Thanks!
I got the behaviour I wanted with:
// init code
int tabcount = 0;
WithMyTabLayout<ParentCtrl> tab[5]; // here I set how many I want
// code to add:
tabctrl.Add(tab[tabcount], "Tab " + AsString(tabcount));
++tabcount;
//code to remove:
tabctrl.Remove(tab[tabcount]);
--tabcount;
Besides that I just add ifs to check if 0 >= tabcount < 5, so I don't go out of the array boundaries.
[Updated on: Mon, 02 July 2012 04:20] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Sep 01 07:20:19 CEST 2024
Total time taken to generate the page: 0.02825 seconds
|