[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] FW: SWT GUI view in Linux

Dear All,

 

            I have designed a GUI by extending the org.eclipse.jface.dialogs.Dialog class in windows. But the same GUI when run in linux, the contents at lower side are not visible, due to mismatch in resolution. Even in windows with lower resolution, some controls are not visible in the GUI.

 

            To avoid this, I redesigned the page by setting the controls in FillLayout, provided max/min/Resize options, added ScrolledComposite etc so that resizing the dialog will work with scrollbars. A sample main application (without extending Dialog class) worked well.

 

            I need to populate Dialog on clicking a menuitem. So added the menuitem through the plugin extension org.eclipse.ui.actionset. The action class that implement IWorkbenchWindowActionDelegate provides IWorkbenchWindow object. The shell obtained from this was passed to the class that extended “org.eclipse.jface.dialogs.Dialog”.  There createDialogArea(Composite parent) was overridden, set Layout of parent.getShell() as FillLayout added  ScrolledComposite etc as done in the sample app.

 

protected Control createDialogArea(Composite parent) {           

parent.getShell().setLayout(new FillLayout());

            Composite composite11 = new Composite(parent.getShell(), SWT.NONE);

            composite11.setLayout(new FillLayout());

           

            final TabFolder tabFolder = new TabFolder(composite11, SWT.NONE);

            final TabItem tab1TabItem = new TabItem(tabFolder, SWT.NONE);

            tab1TabItem.setText("Tab1");

           

            final ScrolledComposite scrolledComposite = new ScrolledComposite(

                        tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);

            scrolledComposite.setExpandVertical(true);

            scrolledComposite.setExpandHorizontal(true);

            tab1TabItem.setControl(scrolledComposite);

            final Composite composite = new Composite(scrolledComposite, SWT.NONE);

            scrolledComposite.setContent(composite);

            scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT,

                        SWT.DEFAULT));

            return composite11;

      }

 

 But I could see that this throws the exception - java.lang.ClassCastException: org.eclipse.swt.layout.GridData cannot be cast to org.eclipse.swt.layout.FillData.

 

On debugging the app, could understand that the exception was thrown because we are not setting LayoutData parameter. The default Layout/LayoutData for shell obtained from IWorkbenchWindow is GridLayout/GridLayoutData. We set the Layout as parent.getShell().setLayout(new FillLayout());

but couldn’t set LayoutData as FillLayoutData since it is not a public member(same time GridDataLayout and RowDataLayout are public members…!!).

 

So I think, here is the point where I failed.

 

I need to add scrollbar to the dialog so that GUI will be visible in any resolution. For that I needs FillLayout(), since resizing dialog with scrollbars works for this layout

 

Am I doing things in a wrong way? Is there an alternate way? Please Help….

 

 

Thanks in Advance,

Malu

 

 

 

 

 

 

***** Confidentiality Statement/Disclaimer *****

This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt.

The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message.