Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to place a SashForm onto a TabItem (is a size problem)
How to place a SashForm onto a TabItem (is a size problem) [message #436557] |
Wed, 19 May 2004 12:12 |
Eclipse User |
|
|
|
Originally posted by: thomas.hollfelder.XXXX.de
I want to place a SashForm containing other widget onto a TabItem. But I
don't know how because the tabItem needs a control for the setControl()
method and the SashForm needs a Composite in the constructor.
The problem arises from a size problem. see code below
public class FactorAdmin extends ApplicationWindow {
private static Menu m_mainMenu;
static FactormanagmentService service = null;
final static Display display = new Display();
final static Shell m_shell=new Shell(display,SWT.SHELL_TRIM);
/**
* @param arg0
*/
public FactorAdmin() {
super(m_shell);
addStatusLine();
addMenuBar();
addToolBar(SWT.FLAT|SWT.HORIZONTAL);
}
protected Control createContents(Composite parent) {
m_shell.setText("Ausschreibungs- undLeasingraten-
Management");
TabFolder tab =new TabFolder(parent, SWT.BORDER);
TabItem item= new TabItem(tab,SWT.NULL);
item.setText("Ausschreibungskatalog");
TabItem next=new TabItem(tab,SWT.NULL);
next.setText("NochNix");
SashForm l_form = new SashForm(tab, SWT.HORIZONTAL |
SWT.NULL|SWT.BORDER);
l_form.setLayout(new FillLayout());
RequestableCarTree l_tree = new RequestableCarTree
(this,l_form,SWT.CHECK);
item.setControl(l_form);
// Point size=l_tree.computeSize(500, SWT.DEFAULT);
// System.out.println(size);
// int width1 = Math.max(400, size.x);
// int height1 = Math.max(500, size.y);
// System.out.println("width="+ width1+ ", height=" + height1);
// l_tree.setSize(width1,height1);
// Point size2=l_form.computeSize(size.x,SWT.DEFAULT,true);
// System.out.println(size2);
// int width2 = Math.max(400, size2.x);
// int height2 = Math.max(500, size2.y);
// System.out.println("width="+ width2+ ", height=" + height2);
// l_form.setSize(width2,height2);
Point size3=tab.computeSize(500,SWT.DEFAULT);
System.out.println(size3);
int width = Math.max(400, size3.x);
int height = Math.max(500, size3.y);
System.out.println("width="+ width+ ", height=" + height);
tab.setSize(width,height);
System.out.println(tab.getSize());
System.out.println(this.getInitialSize());
return tab;
}
public static void main(String[] args) {
FactorAdmin a = new FactorAdmin();
a.setBlockOnOpen(true);
a.open();
Display.getCurrent().dispose();
}
}
System.out is:
Point {512, 63}
width=512, height=500
Point {512, 500}
Point {199, 170}
The window is very small and no chance to set the size.
and my ApplicationWindow does not appear in the TaskBar.
Help appreciated.
Thanks,
Thomas
|
|
|
Re: How to place a SashForm onto a TabItem (is a size problem) [message #436642 is a reply to message #436557] |
Fri, 21 May 2004 12:59 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
protected Control createContents(Composite parent) {
m_shell.setText("Ausschreibungs- undLeasingraten-
Management");
TabFolder tab =new TabFolder(parent, SWT.BORDER);
TabItem item= new TabItem(tab,SWT.NULL);
item.setText("Ausschreibungskatalog");
TabItem next=new TabItem(tab,SWT.NULL);
next.setText("NochNix");
Composite comp = new Composite(tab, SWT.NONE); // !!!!!!!!!!!
comp.setLayout(new FillLayout()); // !!!!!!!!!!!
SashForm l_form = new SashForm(comp, SWT.HORIZONTAL | SWT.NULL|SWT.BORDER);
// !!!!! use co p as parent of SashForm
// l_form.setLayout(new FillLayout()); // !!!!!!!!!!! DO NOT DO THIS
RequestableCarTree l_tree = new RequestableCarTree(this,l_form,SWT.CHECK);
item.setControl(comp); // !!!!!!! place comp into item
"Hollfelder" <thomas.hollfelder@XXXX.de> wrote in message
news:Xns94EE91CD8E09Dthomashollfelder@204.138.98.10...
> I want to place a SashForm containing other widget onto a TabItem. But I
> don't know how because the tabItem needs a control for the setControl()
> method and the SashForm needs a Composite in the constructor.
>
> The problem arises from a size problem. see code below
>
> public class FactorAdmin extends ApplicationWindow {
>
> private static Menu m_mainMenu;
> static FactormanagmentService service = null;
>
> final static Display display = new Display();
> final static Shell m_shell=new Shell(display,SWT.SHELL_TRIM);
>
> /**
> * @param arg0
> */
> public FactorAdmin() {
> super(m_shell);
> addStatusLine();
> addMenuBar();
> addToolBar(SWT.FLAT|SWT.HORIZONTAL);
> }
>
> protected Control createContents(Composite parent) {
> m_shell.setText("Ausschreibungs- undLeasingraten-
> Management");
> TabFolder tab =new TabFolder(parent, SWT.BORDER);
> TabItem item= new TabItem(tab,SWT.NULL);
> item.setText("Ausschreibungskatalog");
> TabItem next=new TabItem(tab,SWT.NULL);
> next.setText("NochNix");
> SashForm l_form = new SashForm(tab, SWT.HORIZONTAL |
> SWT.NULL|SWT.BORDER);
> l_form.setLayout(new FillLayout());
> RequestableCarTree l_tree = new RequestableCarTree
> (this,l_form,SWT.CHECK);
> item.setControl(l_form);
>
> // Point size=l_tree.computeSize(500, SWT.DEFAULT);
> // System.out.println(size);
> // int width1 = Math.max(400, size.x);
> // int height1 = Math.max(500, size.y);
> // System.out.println("width="+ width1+ ", height=" + height1);
> // l_tree.setSize(width1,height1);
> // Point size2=l_form.computeSize(size.x,SWT.DEFAULT,true);
> // System.out.println(size2);
> // int width2 = Math.max(400, size2.x);
> // int height2 = Math.max(500, size2.y);
> // System.out.println("width="+ width2+ ", height=" + height2);
> // l_form.setSize(width2,height2);
> Point size3=tab.computeSize(500,SWT.DEFAULT);
> System.out.println(size3);
>
> int width = Math.max(400, size3.x);
> int height = Math.max(500, size3.y);
> System.out.println("width="+ width+ ", height=" + height);
> tab.setSize(width,height);
> System.out.println(tab.getSize());
> System.out.println(this.getInitialSize());
>
>
> return tab;
> }
>
> public static void main(String[] args) {
>
> FactorAdmin a = new FactorAdmin();
> a.setBlockOnOpen(true);
> a.open();
> Display.getCurrent().dispose();
>
> }
>
>
>
>
> }
>
>
> System.out is:
>
> Point {512, 63}
> width=512, height=500
> Point {512, 500}
> Point {199, 170}
>
> The window is very small and no chance to set the size.
>
> and my ApplicationWindow does not appear in the TaskBar.
>
>
> Help appreciated.
>
> Thanks,
> Thomas
|
|
|
Goto Forum:
Current Time: Thu Apr 25 21:15:34 GMT 2024
Powered by FUDForum. Page generated in 0.02692 seconds
|