How to add Widgets to GridLayout dynamically,how to make tableviewer resizable

24 Views Asked by At

I am using a Gridlayout like screenshot

Tableviewer1 , TableViewer2, Button

My Question is

how to add text and label dynamically when user clicking Button?

How to make TableViewer resizable?enter image description here

1

There are 1 best solutions below

0
greg-449 On

If you want to resize parts by dragging use a SashForm control to divide up the part in to two or more sections. You can then drag the sashes to resize.

If you have a limited number of controls you wish to show or hide you can use the exclude member of GridData and the control setVisible method:

GridData data = new GridData(.... )
data.exclude = true;
control.setLayoutData(data);
control.setVisible(false);

Reverse the exclude and setVisible settings to show the control. You will need to call layout(true) on the parent Composite to redo the layout.

You can also just create new controls as required in the Composite, again calling layout(true) on the composite.