I am new to SWT. The project I'm working on has a basic composition with 3 composite composites. The upper composite consists of buttons, and the middle composite is designed to display content, and the lower one is for other purposes. What should happen when I click the button in the top compound element, it should initiate a change in the content in the middle composition. this is the code i use for this
public void widgetSelected(SelectionEvent e) {
Composite currentCenterComposite = EMWindow.getCenterCompsiteState();
Composite outerComposite=EMWindow.getOuterCompsiteState();
if ((currentCenterComposite != null) && (!currentCenterComposite.isDisposed())) {
Object[] children = currentCenterComposite.getChildren ();
for (int i = 0; i < children.length; i++) {
((Composite)children[i]).dispose();
}
}
currentCenterComposite = new CenterComp(currentCenterComposite);
GridData gd_centerComposite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_centerComposite.minimumHeight = 50;
currentCenterComposite.setLayoutData(gd_centerComposite);
currentCenterComposite.layout(true);
outerComposite.layout(true);
}
The problem right now, after I click the button and the code has been executed, nothing happens until I change the size of the GUI, then the content will appear in the middle composition.
source
share