| How is it possible to layout shell with CoolBar in? [message #436395] |
Tue, 18 May 2004 12:05  |
Eclipse User |
|
|
|
Originally posted by: baranetskyy.NOSPAM.prosilog.com
Hi,
I have a problem with the CoolBar...
After the creation of the CoolBar if an user
change the CoolItem's placement for the multi-lines
form, then any Control which is placed under CoolBar
will be truncated without do layout...
Does it exist any possibility to layout the Control after
any changes?
Thanx a lot,
V.
P.S. Here you can find the exemple:
package testAndTest;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.CoolItem;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.CoolBar;
public class Test
{
public static void main(String[] args)
{
Display display = new Display ();
Shell shell = new Shell();
{
final GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
shell.setLayout(layout);
}
{
final CoolBar coolBar = new CoolBar(shell, SWT.NONE);
coolBar.setLayoutData(new
GridData(GridData.HORIZONTAL_ALIGN_FILL));
for(int i = 0; i < 10; i++)
{
final CoolItem coolItem = new CoolItem(coolBar,
SWT.DROP_DOWN);
final Button button = new Button(coolBar, SWT.FLAT);
button.setText("Button " + i);
coolItem.setControl(button);
coolItem.setSize(coolItem.computeSize(SWT.DEFAULT,
SWT.DEFAULT));
}
}
{
new Label(shell,
SWT.SEPARATOR|SWT.HORIZONTAL).setLayoutData(new
GridData(GridData.FILL_HORIZONTAL));
}
{
new Composite(shell, SWT.BORDER).setLayoutData(new
GridData(GridData.FILL_BOTH));
}
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
|
|
|
| Re: How is it possible to layout shell with CoolBar in? [message #436405 is a reply to message #436395] |
Tue, 18 May 2004 13:13   |
Eclipse User |
|
|
|
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet150.html
"Vasyl Baranetskyy" <baranetskyy@NOSPAM.prosilog.com> wrote in message
news:c8dbis$n1k$1@eclipse.org...
> Hi,
> I have a problem with the CoolBar...
> After the creation of the CoolBar if an user
> change the CoolItem's placement for the multi-lines
> form, then any Control which is placed under CoolBar
> will be truncated without do layout...
> Does it exist any possibility to layout the Control after
> any changes?
>
> Thanx a lot,
> V.
>
> P.S. Here you can find the exemple:
>
> package testAndTest;
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.CoolItem;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.CoolBar;
>
> public class Test
> {
> public static void main(String[] args)
> {
> Display display = new Display ();
> Shell shell = new Shell();
> {
> final GridLayout layout = new GridLayout();
> layout.numColumns = 1;
> layout.marginHeight = 0;
> layout.marginWidth = 0;
> layout.horizontalSpacing = 0;
> layout.verticalSpacing = 0;
> shell.setLayout(layout);
> }
> {
> final CoolBar coolBar = new CoolBar(shell, SWT.NONE);
> coolBar.setLayoutData(new
> GridData(GridData.HORIZONTAL_ALIGN_FILL));
> for(int i = 0; i < 10; i++)
> {
> final CoolItem coolItem = new CoolItem(coolBar,
> SWT.DROP_DOWN);
> final Button button = new Button(coolBar, SWT.FLAT);
> button.setText("Button " + i);
> coolItem.setControl(button);
> coolItem.setSize(coolItem.computeSize(SWT.DEFAULT,
> SWT.DEFAULT));
> }
> }
> {
> new Label(shell,
> SWT.SEPARATOR|SWT.HORIZONTAL).setLayoutData(new
> GridData(GridData.FILL_HORIZONTAL));
> }
> {
> new Composite(shell, SWT.BORDER).setLayoutData(new
> GridData(GridData.FILL_BOTH));
> }
> shell.open ();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> }
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04363 seconds