Reordering and renaming tabs


Hi all!

I have a TabbedComponent and I’d like to allow the user to reorder the tabs moving them with the mouse. Is that possible?.

Also I’d like to be able to edit the tab name just clicking on the tab and doing the tab name editable. Is any way to do it?

Thank you!


I’ve done the renaming of tabs in place part.

To do so, I derived a new class from TextEditor and ActionBroadcaster. I overrode inputAttemptWhenModal() to get the text from the TextEditor, and send it as an action message to a listener.

The code to edit the tab then looked like this:

mEditLabel = new CTabLabelTextEditor(T("Tab Label"));
mTabLabelBeingEdited = tabIndex;
mEditLabel->setBounds(theLabelXPos, Ypos, w, h);	
mEditLabel->enterModalState();	//make the editor modal, so clicks outside the box will delete it
mEditLabel->addActionListener(this);	//listen to messages from the text editor 

You can’t trigger the editing with a click or double click (that changes tabs!), so I used a right click to allow editing, and put this code into an overridden popupMenuClickOnTab() method in my tab class.


+1 for re-ordering tabs :wink:



Igor, thanks for your code… I’ll try it but i don’t know if is exactly what i want.
What i exactly want is that when i create a new tab, or when i double click in one, the name of the tab becomes editable so you can change it directly on the tab, not in a new popup window.

And auspuff, what means +1? It means that you want do the same? Sorry, I’m new with juce and in the forum i maybe i dont understand :stuck_out_tongue:

Thanks again,


What i exactly want is […] when i double click in one, the name of the tab becomes editable
You’re going to get in trouble there. How will juce know if you’re intending to click on a tab to change to a new tab, or if you’re intending to edit the name. I think you’ll be better off finding another way (like a right click) to indicate that you want to change the tab name

The above code will do that. You can set the TextEdit component that appears to sit right on top of the tab’s name, and type into that. It will give the illusion of editing the name directly, and won’t as if you’ve opened a new window.