How to re-set shell size [message #461138] |
Fri, 16 September 2005 19:34 |
Eclipse User |
|
|
|
Originally posted by: davidyoung_2001.yahoo.co.uk
I have an application, I add a menu, then a toolbar with graphics - when I
then try to split up the remain shell area with sahform and griddata, i
end up with the sasform and gridlayout to right of the toolbar:
------------------------------------------------------------ ----
| Shell
| Menu1 menu2
| tool1 tool2 tool3 tool4 |----------------|------------|
| | sashform and griddata appears here
Obvious I need to reset the shell size to the orginal size - toolbar size
but how do I do this?
|
|
|
Re: How to re-set shell size [message #461140 is a reply to message #461138] |
Fri, 16 September 2005 19:53 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Could you please give a snippet of code of how you did this? The MenuBar
should be distinct and the toolbar should not be next to it.
david young wrote:
> I have an application, I add a menu, then a toolbar with graphics - when
> I then try to split up the remain shell area with sahform and griddata,
> i end up with the sasform and gridlayout to right of the toolbar:
>
> ------------------------------------------------------------ ----
> | Shell | Menu1 menu2 | tool1 tool2 tool3
> tool4 |----------------|------------|
> | | sashform and griddata appears here
> Obvious I need to reset the shell size to the orginal size - toolbar
> size but how do I do this?
--
Thanks,
Rich Kulp
|
|
|
Re: How to re-set shell size [message #461146 is a reply to message #461140] |
Sat, 17 September 2005 11:00 |
Eclipse User |
|
|
|
Originally posted by: davidyoung_2001.yahoo.co.uk
package test3;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
/**
* @author David Young
*
*/
public class test3 {
private Shell sShell = null;
private ToolBar toolBar = null;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/* Before this is run, be sure to set up the launch configuration
(Arguments->VM Arguments)
* for the correct SWT library path in order to run with the SWT dlls.
* The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_3.1.0.j ar
*/
Display display = Display.getDefault();
test3 thisClass = new test3();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell();
sShell.setText("myMail");
toolBar = new ToolBar(sShell, SWT.FLAT|SWT.SHADOW_OUT);
ToolItem test1 = new ToolItem(toolBar, SWT.DROP_DOWN);
test1.setText("test1");
ToolItem test2 = new ToolItem(toolBar, SWT.PUSH);
test2.setText("test2");
ToolItem test3 = new ToolItem(toolBar, SWT.PUSH);
test3.setText("test3");
toolBar.pack();
sShell.setLayout(new FillLayout());
SashForm form = new SashForm(sShell, SWT.HORIZONTAL);
Composite leftComposite = new Composite(form, SWT.BORDER);
leftComposite.setLayout(new RowLayout());
final Composite rightComposite = new Composite(form, SWT.BORDER);
rightComposite.setLayout(new GridLayout());
SashForm sashForm2 = new SashForm(rightComposite, SWT.VERTICAL);
sashForm2.setLayout(new GridLayout());
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
sashForm2.setLayoutData(gridData);
Composite composite2 = new Composite(sashForm2, SWT.BORDER);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
composite2.setLayoutData(gridData);
Composite composite3 = new Composite(sashForm2, SWT.BORDER);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
composite3.setLayoutData(gridData);
form.setWeights(new int[] {30, 70});
}
}
|
|
|
Re: How to re-set shell size [message #461153 is a reply to message #461146] |
Sat, 17 September 2005 14:22 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
I don't know where you got a menu from. The example you gave has no menu
in it.
However, the reason everything is flow out to one line is because you
gave the shell a FillLayout. The toolbar and SashForm are siblings on
the shell. Filllayout says to layout siblings all together on one row.
Your code looks like it was created through the VE, it is the VE style.
so I would suggest using the Ve to edit your code.
First thing is you want a GridLayout with one column for the Shell, not
a FillLayout. then you want the Toolbar to be first in the shell with
lahyout data that says Grab Excess Horizontal and Fill Horizontal. Then
you drop the SashForm with Fill Both, Grab Excess Vertical and Grab
Excess horizontal.
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.03336 seconds