Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Wizard page's content does not show in a standalone JFace/SWT application(the controls in wizard page does not show if the controls are defined in a child composite)
Wizard page's content does not show in a standalone JFace/SWT application [message #538178] Sun, 06 June 2010 05:15 Go to next message
Yu Zhang is currently offline Yu ZhangFriend
Messages: 3
Registered: June 2010
Junior Member
I have a standalone JFace/SWT application which will show a wizard dialog. in the wizard page, if i create a child composite to contain the controls, the controls don't show. but if i just directly create the control to the parent composite, it can show correctly. the code is as below:

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

public class Test extends ApplicationWindow {

class MyPage extends WizardPage {

protected MyPage(String pageName) {
super(pageName);
}

@Override
public void createControl(Composite parent) {
/** the button will never show in the child composite */
// Composite composite = new Composite(parent, SWT.NULL);
//
// Button button = new Button(composite,SWT.PUSH);
// button.setText("hello");
// setControl(composite);
/*********************************************************/

//the button can show if its container is the parent!
Button button = new Button(parent,SWT.PUSH);
button.setText("hello");
setControl(parent);
}

}

class MyWizard extends Wizard {

@Override
public void addPages() {

MyPage page = new MyPage("test");
this.addPage(page);

}

@Override
public boolean performFinish() {
// TODO Auto-generated method stub
return false;
}

}

/**
* @param parentShell
*/
public Test(Shell parentShell) {
super(parentShell);
}

public static void main(String[] args) {
Test window = new Test(null);
window.setBlockOnOpen(false);
window.open();
WizardDialog dialog = new WizardDialog(window.getShell(), window.new MyWizard());
dialog.open();

}


}

any suggestions are appreciated!
Re: Wizard page's content does not show in a standalone JFace/SWT application [message #538245 is a reply to message #538178] Mon, 07 June 2010 05:35 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 06/06/10 10:45 AM, Yu Zhang wrote:
>
> public void createControl(Composite parent) {
> /** the button will never show in the child composite */
> // Composite composite = new Composite(parent, SWT.NULL);
> //
> // Button button = new Button(composite,SWT.PUSH);
> // button.setText("hello");
> // setControl(composite);
> /*********************************************************/

You haven't set the layout for the composite.

- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
icon7.gif  Re: Wizard page's content does not show in a standalone JFace/SWT application [message #538278 is a reply to message #538245] Mon, 07 June 2010 08:18 Go to previous message
Yu Zhang is currently offline Yu ZhangFriend
Messages: 3
Registered: June 2010
Junior Member
yes, u r right, after set the layout, the problem disappears! thanks.
Previous Topic:Is there a way to always show the scrollbar for a List?
Next Topic:SWT Date Time in 24 hours format
Goto Forum:
  


Current Time: Tue Apr 23 16:07:11 GMT 2024

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

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

Back to the top