I am new to SWT. The project I am working on has a main composite with 3 children composite on it. the Upper composite consist with buttons, and the middle composite is for displaying content, and the lower composite is for other purpose. What has to happen is when i click a button in the upper composite, it has to trigger the content change in the middle composite. this is the code i am used to do this
public void widgetSelected(SelectionEvent e) {
/* Retrieve the contents that are currently in middle composite*/
Composite currentCenterComposite = EMWindow.getCenterCompsiteState();
/* Retrieve the main composite*/
Composite outerComposite=EMWindow.getOuterCompsiteState();
if ((currentCenterComposite != null) && (!currentCenterComposite.isDisposed())) {
/* Remove children that are already laid out */
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);
//currentOuterComposite.layout();
outerComposite.layout(true);
}
The Problem right now is after i click the button and above code was executed, nothing seems happen until i resize the GUI, then the content in the middle composite will appear.