Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » the composite could not display immediately?? why?(composite ,listener)
icon8.gif  the composite could not display immediately?? why? [message #895716] Sun, 15 July 2012 09:24 Go to next message
zhang lei is currently offline zhang leiFriend
Messages: 18
Registered: July 2012
Junior Member
In the shell,I use the GridLayout,the left is the ToolBar and the right is the main board that store my own composite. I add the listener to the ToolItem. When click the ToolItem the right of the shell could display different composite.But it can not display immediately.In the widgetSelected()method ,my code is :
		Control [] controls = parent.getChildren();
		//controls[1].dispose();
		if (controls.length>1) {
			//controls[1].dispose();
			if (controls[1].getClass() !=DepartmentPanel.class) {
				controls[1].dispose();
				DepartmentPanel dp = new DepartmentPanel(parent,SWT.BORDER,d);
				GridData gdOfficePanel = new GridData(GridData.FILL_BOTH);
				gdOfficePanel.horizontalSpan = 1;
				dp.setLayoutData(gdOfficePanel);
				dp.setVisible(true);
				dp.redraw();
//				parent.redraw();
			}
		}


The DepartmentPanel dp could not display immediatelly.when I click the maxbutton ,it can display.why?you know ,my english is bad,understand???thank you....
Re: the composite could not display immediately?? why? [message #895753 is a reply to message #895716] Sun, 15 July 2012 17:51 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

you have to layout the parent of the DepartmentPanel because immediately after creating the DepartmentPanel has no bounds.

So you have to call parent.layout().
Re: the composite could not display immediately?? why? [message #895778 is a reply to message #895753] Mon, 16 July 2012 00:32 Go to previous message
zhang lei is currently offline zhang leiFriend
Messages: 18
Registered: July 2012
Junior Member
How wonderful!,Thanks,Jan.Thank You very much.
Previous Topic:SWT 4.2 not available?
Next Topic:java.lang.StackOverflowError on SWT version 3555
Goto Forum:
  


Current Time: Fri Nov 28 12:41:14 GMT 2014

Powered by FUDForum. Page generated in 0.02103 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software