Reputation: 123
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?
Upvotes: 4
Views: 426
Reputation: 2352
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();
Upvotes: 5