1

Am developing an eclipse plugin which has few wizard pages. I need the wizard window size to be constant, with "BOTH MAXIMISE and MINIMISE disabled", "window RESIZE disabled".

The point is I am not using SHELL. I am using COMPOSITE instead, which doesn't have any style bits.

How can I do that? I am just providing a part of my entire code:

public void createControl(Composite parent) 
{
    // TODO Auto-generated method stub
    composite = new Composite(parent, SWT.NONE );
    composite.setLayout(new GridLayout());

    Composite selectAdapterComposite = new Composite(composite, SWT.NONE);
    FormLayout reportOptionsCompositeLayout = new FormLayout();
    reportOptionsCompositeLayout.marginHeight = 1;
    reportOptionsCompositeLayout.marginWidth = 1;
    selectAdapterComposite.setLayout(reportOptionsCompositeLayout);

    buttonInterfaceSelection = new Button(selectAdapterComposite,SWT.RADIO);
            //SWT.CHECK);
    buttonInterfaceSelection.setText("Generate adapter using interface !");
    buttonInterfaceSelection.setSelection(true);
    buttonInterfaceSelection.addListener(SWT.Selection, this);
    FormData exportInToExcelButtonData = new FormData();
    exportInToExcelButtonData.left = new FormAttachment(null, 5);
    buttonInterfaceSelection.setLayoutData(exportInToExcelButtonData);

    // One Text Box

    Label searchBoxLabel = new Label(selectAdapterComposite, SWT.None);
    searchBoxLabel.setText("Search to select [Type to get the results below]");
    FormData destinationLabelData = new FormData();
    destinationLabelData.top = new FormAttachment(buttonInterfaceSelection, 10);
    destinationLabelData.left = new FormAttachment(null, 5);
    searchBoxLabel.setLayoutData(destinationLabelData);
    searchTextBox = new Text(selectAdapterComposite, SWT.BORDER);
    searchTextBox.setSize(20, 2);

    FormData searchTextBoxData = new FormData();
    searchTextBoxData.top = new FormAttachment(searchBoxLabel, 8);
    searchTextBoxData.left = new FormAttachment(null, 5);
    // destinationFolderPathData.left = new
    // FormAttachment(destinationLabel,15);
    searchTextBoxData.width = 400;
    searchTextBox.addListener(SWT.Modify, this);
    searchTextBox.setEnabled(true);
    searchTextBox.setLayoutData(searchTextBoxData);

    .
    .
    .   
    .
    .

    setControl(composite);
}

Please help me out.

4

2 回答 2

1

Your code snippet is irrelevant to your question. The key word is wizard. When you create that wizard, it requires a Shell, so you can set its style bits there.

A WizardDialog's constructor:

public WizardDialog(Shell parentShell, IWizard newWizard)

Example of shell style bits:

parentShell.setShellStyle(parentShell.getShellStyle() | (~SWT.RESIZE));
于 2013-09-12T13:39:38.077 回答
1

Thanks for your reply... am a newbie to swt and your answer gave me an important info which I dint know before. Now then, I just took some time to go through widgets documentation and found something.

Composite : Instances of this class are controls which are capable of containing other controls.

Shell : Instances of this class represent the "windows" which the desktop or "window manager" is managing.

I realised that my understanding of SHELL and COMPOSITE was wrong.

Conclusion: So I have to depend upon SHELL to give window resizing controls and using a COMPOSITE does not give me any resizing option...

Correct me if am wrong please.. hope this will be useful to other noobs too... Thanks.

P.S.: now i understoood, my code segment is irrelevant to my question cos, I am working on someone else's code and trying to make some changes to it. instead of making changes in SHELL (which is created in some other class) i am doing it in COMPOSITE.

于 2013-09-13T03:06:29.963 回答