Home » U++ Library support » TabCtrl » A few questions regarding TabCtrl
Re: A few questions regarding TabCtrl [message #36751 is a reply to message #36748] |
Mon, 02 July 2012 04:15   |
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: Mon May 12 13:07:01 CEST 2025
Total time taken to generate the page: 0.00605 seconds
|