PDA

View Full Version : How to create closeable tabpanes?


Jacek99
12-30-2005, 06:21 AM
I need to have tabpanes that will have an "x" type button embedded in them so that the user can click on it and close the entire tabpane (similar to the way the editor pages work in NetBeans and Eclipse).

The tabpane does not seem to allow to customize the content of the tabpane "selector", just the contents of the tab page it represents...is there a way to do what I have in mind?

You can see it in this image:
http://www.netbeans.org/images/articles/quickstart-web/palette.png

Notice the "x" in the right-hand of each tab page selector that allows to close it...

jcmaxx
12-30-2005, 07:16 AM
The tabpane does not seem to allow to customize the content of the tabpane "selector", just the contents of the tab page it represents...is there a way to do what I have in mind?
I would either create a completely new version of the tabelement (by extending basetabelement) or extend tabelement and use the placement attribute to control where your close button is placed.

Look at the source code for the tabelement (../lps/components/lz/tabelement.lzx) and you will see it has two main views (top and container). The top one also has a couple subviews. The one named "header" is probably what you want.

You might also want to look at the toggleselected attribute of the tabslider component. Setting it to true allows a tab to be toggled open and closed.

Hope this helps.