Tabbing


#1

i’m currently working with the tabbed component, and i’m getting stuck on how to handle multiple tabs, without having to recreate a new content component for the tab every time. i see that in

createPanelComponentForTab (const int tabIndex, const String& tabName, bool& componentCanBeDeleted)

there is the out reference componentCanBeDeleted, that i sure have setted to false, but then how can i manage to create a content component if the tab is a new one , while returning a previously created one that is already there in the tabbed component ?
actually i’m working with tab indexes, so i’m not relying on names, but i see there is the need of a function that gets the Component* passing it a tab index, cause you can only get back the currently selected one. but if i want to get a Component tab that isn’t the current ?

also, investigating the demo, i see there is this function in the TabbedComponent inherited example (WidgetsDemo line ~635).

void deletePanelComponent (Component* comp) { delete comp; }

but actually this isn’t called anywhere nor is a virtual method of the TabbedComponent class… mmh maybe someone could clarify myself…


#2

oh, maybe i have to keep track myself of the array of currently opened tabs ? sure no :wink: juce is smart enough to do this for me… i hope ;/


#3

Yes, you’ll have to keep track of the components yourself if you don’t want them to get automatically deleted. There’s not really much it could do to help if you want to manage the components yourself, because you’d have to keep your own pointers anyway, so you can delete them later on when they’re no longer needed.

Apologies for the deletePanelComponent method - that was just left in there by mistake, probably from when I was designing the tabbed component, and can be deleted…


#4

that’s not true, cause i’m working in some kind of open documents text editors, they’re all the same class, and all behaves the same. if the pointers was already stored in the tabbed (but they aren’t), why i should need’em saved elsewhere if i can get’em easily by index (or name or currently selected) ?

i think i will extend TabbedComponent to be lot more easy to work with…

anyway, thanx for the clarify


#5