Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding SWT Controls

Tags:

eclipse-rcp

How we can hide the SWT controls? I know setVisible() method of control class can be used. But the disadvantage of it is, hidden widget will not released and can't be used by other widgets.

Is there any other approach which can be adopted?

like image 700
A Kumar Avatar asked Sep 05 '25 03:09

A Kumar


1 Answers

You can use layout data. In case of GridLayout, you can use exclude specific widget from being drown on canvas.

Composite comp = new Composite(shell, SWT.NONE);  
comp.setLayout(new GridLayout(4, false));  
Label hidenLabel = new Label (comp, SWT.NONE);  
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);  
hidenLabel.setGridData(gridData );  
//hide the button  
gridData .exclude = true;  
comp.pack(); 
like image 59
Shashwat Avatar answered Sep 08 '25 00:09

Shashwat