Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » sorry, I ask this question again.
sorry, I ask this question again. [message #445264] Mon, 01 November 2004 03:48 Go to next message
Eclipse UserFriend
Originally posted by: liankun_mail.21cn.com

Good day all:

I meet control paint trouber while i put a table into sashform control .
When i make the shell maximum , the table control will not refresh
correctly. whether or not i use the sashform correctly?

The source code is as follows, and the table control is added by method
"PPP".

And i write some notation in my source code line 118 .You can test it
according to my notation. Ths!

The new source code is as follows:


/*
* Created on 2004-10-29
*/
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

/**
* @author JeffLian.
*/
public class T09 {
public static void main(String[] args) {

//create shell
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());

Composite parent1 = new Composite(shell, SWT.NONE);
parent1.setLayout(new FillLayout());

Composite parent = new Composite(parent1, SWT.BORDER);

GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
parent.setLayout(layout);

Composite pane = new Composite(parent, SWT.BORDER);
pane.setLayoutData(new GridData(GridData.FILL_BOTH));
pane.setLayout(new FillLayout());

Composite aa = new Composite(pane, SWT.NONE);
createPartControl(aa);

shell.setBounds(20, 30, 500, 500);
shell.open();
while (!shell.isDisposed()){
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();

}

public static void createPartControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
parent.setLayout(layout);

Composite control = new Composite(parent, SWT.BORDER);
control.setLayoutData(new GridData(GridData.FILL_BOTH));

GridLayout controlLayout = new GridLayout();
controlLayout.horizontalSpacing = 0;
controlLayout.verticalSpacing = 0;
controlLayout.marginHeight = 0;
controlLayout.marginWidth = 0;

control.setLayout(controlLayout);

Composite contentArea = new Composite(control, SWT.NONE);
GridData clientData = new GridData(GridData.FILL_BOTH);
contentArea.setLayoutData(clientData);

contentArea.setLayout(new FillLayout());

Composite ppp = new Composite(contentArea, SWT.NONE);
PPP(ppp);

if (parent != null) return;
}

public static void PPP(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
parent.setLayout(layout);

Composite pane1 = new Composite(parent, SWT.BORDER);
pane1.setLayoutData(new GridData(GridData.FILL_BOTH));

pane1.setLayout(new GridLayout());

Label label = new Label(pane1, SWT.PUSH);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label.setText("sdfsdf");

SashForm form = new SashForm(pane1, SWT.VERTICAL);
form.setLayoutData(new GridData(GridData.FILL_BOTH));
form.setLayout(new FillLayout());

Composite child1 = new Composite(form, SWT.NONE);
child1.setLayout(new FillLayout());
//table = new CTable(child1, new CellDisplay(), new Renderer());
new Label(child1, SWT.NONE).setText("Label in pane 1");

Composite child2 = new Composite(form, SWT.NONE);
child2.setLayout(new FillLayout());
new Button(child2, SWT.PUSH).setText("Button in pane2");

Composite child3 = new Composite(form, SWT.NONE);
child3.setLayout(new FillLayout());

Composite ccc = new Composite(child3, SWT.BORDER);
ccc.setLayout(new FillLayout());

Composite ddd = new Composite(ccc, SWT.BORDER);
ddd.setLayout(new FillLayout());

/**-------------------------------------------------
* Here, Whe i use button control to replace table,
* the button control will refresh correctly while the shell
maximum,
* But when i use table control, why the table control will not
* refresh correctly while the shell maximum ?
*
* [attention please:] Here table's parent composite is
* the composite "ddd" by design.
*
* whether or not this is the table control 's
bug?
-------------------------------------------------**/
//new Button(ddd, SWT.PUSH).setText("Button in pane3");
Table table = new Table(ddd, SWT.FULL_SELECTION);

table.setHeaderVisible(true);
table.setLinesVisible(true);

TableColumn col1 = new TableColumn(table, SWT.CENTER);
col1.setText(" col1");
col1.setWidth(90);
TableColumn col2 = new TableColumn(table, SWT.CENTER);
col2.setText(" col2");
col2.setWidth(90);

for (int i = 0; i < 10; i++){
TableItem item = new TableItem(table, SWT.NONE);
item.setText(new String[] { "row", "col"});
}

form.setWeights(new int[] { 30, 40, 30 });

}
}
Re: sorry, I ask this question again. [message #445282 is a reply to message #445264] Mon, 01 November 2004 16:02 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Can anyone see the problem? It WORKSFORME on my machine.

"JeffLian" <liankun_mail@21cn.com> wrote in message
news:cm4bo1$3bn$1@eclipse.org...
> Good day all:
>
> I meet control paint trouber while i put a table into sashform control .
> When i make the shell maximum , the table control will not refresh
> correctly. whether or not i use the sashform correctly?
>
> The source code is as follows, and the table control is added by method
> "PPP".
>
> And i write some notation in my source code line 118 .You can test it
> according to my notation. Ths!
>
> The new source code is as follows:
>
>
> /*
> * Created on 2004-10-29
> */
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.custom.SashForm;
> import org.eclipse.swt.custom.StackLayout;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.widgets.*;
>
> /**
> * @author JeffLian.
> */
> public class T09 {
> public static void main(String[] args) {
>
> //create shell
> final Display display = new Display();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout());
>
> Composite parent1 = new Composite(shell, SWT.NONE);
> parent1.setLayout(new FillLayout());
>
> Composite parent = new Composite(parent1, SWT.BORDER);
>
> GridLayout layout = new GridLayout();
> layout.marginHeight = 0;
> layout.marginWidth = 0;
> layout.verticalSpacing = 0;
> parent.setLayout(layout);
>
> Composite pane = new Composite(parent, SWT.BORDER);
> pane.setLayoutData(new GridData(GridData.FILL_BOTH));
> pane.setLayout(new FillLayout());
>
> Composite aa = new Composite(pane, SWT.NONE);
> createPartControl(aa);
>
> shell.setBounds(20, 30, 500, 500);
> shell.open();
> while (!shell.isDisposed()){
> if (!display.readAndDispatch()) display.sleep();
> }
> display.dispose();
>
> }
>
> public static void createPartControl(Composite parent) {
> GridLayout layout = new GridLayout();
> layout.marginHeight = 0;
> layout.marginWidth = 0;
> layout.verticalSpacing = 0;
> parent.setLayout(layout);
>
> Composite control = new Composite(parent, SWT.BORDER);
> control.setLayoutData(new GridData(GridData.FILL_BOTH));
>
> GridLayout controlLayout = new GridLayout();
> controlLayout.horizontalSpacing = 0;
> controlLayout.verticalSpacing = 0;
> controlLayout.marginHeight = 0;
> controlLayout.marginWidth = 0;
>
> control.setLayout(controlLayout);
>
> Composite contentArea = new Composite(control, SWT.NONE);
> GridData clientData = new GridData(GridData.FILL_BOTH);
> contentArea.setLayoutData(clientData);
>
> contentArea.setLayout(new FillLayout());
>
> Composite ppp = new Composite(contentArea, SWT.NONE);
> PPP(ppp);
>
> if (parent != null) return;
> }
>
> public static void PPP(Composite parent) {
> GridLayout layout = new GridLayout();
> layout.marginHeight = 0;
> layout.marginWidth = 0;
> layout.verticalSpacing = 0;
> parent.setLayout(layout);
>
> Composite pane1 = new Composite(parent, SWT.BORDER);
> pane1.setLayoutData(new GridData(GridData.FILL_BOTH));
>
> pane1.setLayout(new GridLayout());
>
> Label label = new Label(pane1, SWT.PUSH);
> label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
> label.setText("sdfsdf");
>
> SashForm form = new SashForm(pane1, SWT.VERTICAL);
> form.setLayoutData(new GridData(GridData.FILL_BOTH));
> form.setLayout(new FillLayout());
>
> Composite child1 = new Composite(form, SWT.NONE);
> child1.setLayout(new FillLayout());
> //table = new CTable(child1, new CellDisplay(), new Renderer());
> new Label(child1, SWT.NONE).setText("Label in pane 1");
>
> Composite child2 = new Composite(form, SWT.NONE);
> child2.setLayout(new FillLayout());
> new Button(child2, SWT.PUSH).setText("Button in pane2");
>
> Composite child3 = new Composite(form, SWT.NONE);
> child3.setLayout(new FillLayout());
>
> Composite ccc = new Composite(child3, SWT.BORDER);
> ccc.setLayout(new FillLayout());
>
> Composite ddd = new Composite(ccc, SWT.BORDER);
> ddd.setLayout(new FillLayout());
>
> /**-------------------------------------------------
> * Here, Whe i use button control to replace table,
> * the button control will refresh correctly while the shell
> maximum,
> * But when i use table control, why the table control will not
> * refresh correctly while the shell maximum ?
> *
> * [attention please:] Here table's parent composite is
> * the composite "ddd" by design.
> *
> * whether or not this is the table control 's
> bug?
> -------------------------------------------------**/
> //new Button(ddd, SWT.PUSH).setText("Button in pane3");
> Table table = new Table(ddd, SWT.FULL_SELECTION);
>
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> TableColumn col1 = new TableColumn(table, SWT.CENTER);
> col1.setText(" col1");
> col1.setWidth(90);
> TableColumn col2 = new TableColumn(table, SWT.CENTER);
> col2.setText(" col2");
> col2.setWidth(90);
>
> for (int i = 0; i < 10; i++){
> TableItem item = new TableItem(table, SWT.NONE);
> item.setText(new String[] { "row", "col"});
> }
>
> form.setWeights(new int[] { 30, 40, 30 });
>
> }
> }
>
>
Re: sorry, I ask this question again. [message #445284 is a reply to message #445282] Mon, 01 November 2004 16:29 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This works for me too, running on win2000. JeffLian what are you running
on?

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:cm5mma$t4p$1@eclipse.org...
> Can anyone see the problem? It WORKSFORME on my machine.
>
> "JeffLian" <liankun_mail@21cn.com> wrote in message
> news:cm4bo1$3bn$1@eclipse.org...
> > Good day all:
> >
> > I meet control paint trouber while i put a table into sashform control .
> > When i make the shell maximum , the table control will not refresh
> > correctly. whether or not i use the sashform correctly?
> >
> > The source code is as follows, and the table control is added by method
> > "PPP".
> >
> > And i write some notation in my source code line 118 .You can test it
> > according to my notation. Ths!
> >
> > The new source code is as follows:
> >
> >
> > /*
> > * Created on 2004-10-29
> > */
> > import org.eclipse.swt.SWT;
> > import org.eclipse.swt.custom.SashForm;
> > import org.eclipse.swt.custom.StackLayout;
> > import org.eclipse.swt.layout.*;
> > import org.eclipse.swt.widgets.*;
> >
> > /**
> > * @author JeffLian.
> > */
> > public class T09 {
> > public static void main(String[] args) {
> >
> > //create shell
> > final Display display = new Display();
> > Shell shell = new Shell(display);
> > shell.setLayout(new FillLayout());
> >
> > Composite parent1 = new Composite(shell, SWT.NONE);
> > parent1.setLayout(new FillLayout());
> >
> > Composite parent = new Composite(parent1, SWT.BORDER);
> >
> > GridLayout layout = new GridLayout();
> > layout.marginHeight = 0;
> > layout.marginWidth = 0;
> > layout.verticalSpacing = 0;
> > parent.setLayout(layout);
> >
> > Composite pane = new Composite(parent, SWT.BORDER);
> > pane.setLayoutData(new GridData(GridData.FILL_BOTH));
> > pane.setLayout(new FillLayout());
> >
> > Composite aa = new Composite(pane, SWT.NONE);
> > createPartControl(aa);
> >
> > shell.setBounds(20, 30, 500, 500);
> > shell.open();
> > while (!shell.isDisposed()){
> > if (!display.readAndDispatch()) display.sleep();
> > }
> > display.dispose();
> >
> > }
> >
> > public static void createPartControl(Composite parent) {
> > GridLayout layout = new GridLayout();
> > layout.marginHeight = 0;
> > layout.marginWidth = 0;
> > layout.verticalSpacing = 0;
> > parent.setLayout(layout);
> >
> > Composite control = new Composite(parent, SWT.BORDER);
> > control.setLayoutData(new GridData(GridData.FILL_BOTH));
> >
> > GridLayout controlLayout = new GridLayout();
> > controlLayout.horizontalSpacing = 0;
> > controlLayout.verticalSpacing = 0;
> > controlLayout.marginHeight = 0;
> > controlLayout.marginWidth = 0;
> >
> > control.setLayout(controlLayout);
> >
> > Composite contentArea = new Composite(control, SWT.NONE);
> > GridData clientData = new GridData(GridData.FILL_BOTH);
> > contentArea.setLayoutData(clientData);
> >
> > contentArea.setLayout(new FillLayout());
> >
> > Composite ppp = new Composite(contentArea, SWT.NONE);
> > PPP(ppp);
> >
> > if (parent != null) return;
> > }
> >
> > public static void PPP(Composite parent) {
> > GridLayout layout = new GridLayout();
> > layout.marginHeight = 0;
> > layout.marginWidth = 0;
> > layout.verticalSpacing = 0;
> > parent.setLayout(layout);
> >
> > Composite pane1 = new Composite(parent, SWT.BORDER);
> > pane1.setLayoutData(new GridData(GridData.FILL_BOTH));
> >
> > pane1.setLayout(new GridLayout());
> >
> > Label label = new Label(pane1, SWT.PUSH);
> > label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
> > label.setText("sdfsdf");
> >
> > SashForm form = new SashForm(pane1, SWT.VERTICAL);
> > form.setLayoutData(new GridData(GridData.FILL_BOTH));
> > form.setLayout(new FillLayout());
> >
> > Composite child1 = new Composite(form, SWT.NONE);
> > child1.setLayout(new FillLayout());
> > //table = new CTable(child1, new CellDisplay(), new Renderer());
> > new Label(child1, SWT.NONE).setText("Label in pane 1");
> >
> > Composite child2 = new Composite(form, SWT.NONE);
> > child2.setLayout(new FillLayout());
> > new Button(child2, SWT.PUSH).setText("Button in pane2");
> >
> > Composite child3 = new Composite(form, SWT.NONE);
> > child3.setLayout(new FillLayout());
> >
> > Composite ccc = new Composite(child3, SWT.BORDER);
> > ccc.setLayout(new FillLayout());
> >
> > Composite ddd = new Composite(ccc, SWT.BORDER);
> > ddd.setLayout(new FillLayout());
> >
> > /**-------------------------------------------------
> > * Here, Whe i use button control to replace table,
> > * the button control will refresh correctly while the shell
> > maximum,
> > * But when i use table control, why the table control will not
> > * refresh correctly while the shell maximum ?
> > *
> > * [attention please:] Here table's parent composite is
> > * the composite "ddd" by design.
> > *
> > * whether or not this is the table control
's
> > bug?
> > -------------------------------------------------**/
> > //new Button(ddd, SWT.PUSH).setText("Button in pane3");
> > Table table = new Table(ddd, SWT.FULL_SELECTION);
> >
> > table.setHeaderVisible(true);
> > table.setLinesVisible(true);
> >
> > TableColumn col1 = new TableColumn(table, SWT.CENTER);
> > col1.setText(" col1");
> > col1.setWidth(90);
> > TableColumn col2 = new TableColumn(table, SWT.CENTER);
> > col2.setText(" col2");
> > col2.setWidth(90);
> >
> > for (int i = 0; i < 10; i++){
> > TableItem item = new TableItem(table, SWT.NONE);
> > item.setText(new String[] { "row", "col"});
> > }
> >
> > form.setWeights(new int[] { 30, 40, 30 });
> >
> > }
> > }
> >
> >
>
>
Re: sorry, I ask this question again. [message #445318 is a reply to message #445284] Tue, 02 November 2004 01:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: liankun_mail.21cn.com

I run this code on win2000 os too.
Can anyone tell me that why the table control can't resize and refresh
itself when it's parent composite resized ?

"Grant Gayed" <grant_gayed@ca.ibm.com> д
Re: sorry, I ask this question again. [message #445573 is a reply to message #445318] Mon, 08 November 2004 15:40 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You do not need to set a layout on the SashForm but this shoud not be the
cause of the problem (form.setLayout(new FillLayout())).

Can you post a picture of the incorrect appearance?

"JeffLian" <liankun_mail@21cn.com> wrote in message
news:cm6pn7$nmp$1@eclipse.org...
>I run this code on win2000 os too.
> Can anyone tell me that why the table control can't resize and refresh
> itself when it's parent composite resized ?
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> д
Previous Topic:Is Combo supported in first column of TableTreeViewer?
Next Topic:Make a ViewPart invisible
Goto Forum:
  


Current Time: Fri Dec 04 14:44:27 GMT 2020

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

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

Back to the top