How to hide CTabItem in CTabFolder

I cannot find any method for making the tab invisible or otherwise hidden in the SWT / JFace application. --- I want the second tab to be available (or not) based on some other settings specified by the user.

It should not be so hard to understand!

+4
source share
1 answer

The only way I know is to get rid of CTabItem for the tab you want to hide, and then create a new CTabItem when you want to show it. Sorting,

CTabFolder folder = new CTabFolder(parent, SWT.NONE); Label label = new Label(folder, SWT.NONE); label.setText("Hello"); CTabItem item = new CTabItem(folder); item.setControl(label); // Hide it item.dipose(); // show it again CTabItem item = new CTabItem(folder); item.setControl(label); 

If you want to hide the tab in the middle, you will need to recreate all the tabs after you have placed. This is probably the easiest way if you create a class that contains the control and a field that you can use to switch visibility. Then you can simply knock over all CTabItems and recreate if the scope is true.

+5
source

All Articles