CBanner: I can't mix images and text in Tool Items [message #524076] |
Tue, 30 March 2010 11:07  |
Eclipse User |
|
|
|
Hello
I'm creating a tool bar using the right-hand section of a CBanner. Adding SWT.PUSH Tool Items with an image works fine, but as soon as I add an item which has text but no image, all of the items become invisible. The toolbar space shown is the size required to display them.
This is Eclipse 3.5.1. Is this a feechur or a bug?
Regards, John
|
|
|
Re: CBanner: I can't mix images and text in Tool Items [message #524313 is a reply to message #524076] |
Wed, 31 March 2010 05:06   |
Eclipse User |
|
|
|
Hi John,
I haven't heard of this before. Which platform do you see this on? I
created a basic snippet below that works for me on Windows 2000 and OSX,
does it work for you? And if so, are you able to change it to more closely
resemble your case and to show the problem?
public static void main(String[] args) {
Display display = new Display();
Image image = new Image(display, 16, 16);
GC gc = new GC (image);
gc.fillRectangle(4, 4, 12, 12);
gc.dispose();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
CBanner banner = new CBanner(shell, SWT.NONE);
Button button = new Button(banner, SWT.PUSH);
banner.setLeft(button);
button.setText("a button");
ToolBar toolbar = new ToolBar(banner, SWT.NONE);
banner.setRight(toolbar);
banner.setRightMinimumSize(new Point(200,50));
new ToolItem(toolbar, SWT.NONE).setText("item 1");
new ToolItem(toolbar, SWT.NONE).setImage(image);
new ToolItem(toolbar, SWT.NONE).setText("item 3");
new ToolItem(toolbar, SWT.NONE).setImage(image);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"John Ormerod" <ormeroj@googlemail.com> wrote in message
news:hot42r$1ca$1@build.eclipse.org...
> Hello
> I'm creating a tool bar using the right-hand section of a CBanner. Adding
SWT.PUSH Tool Items with an image works fine, but as soon as I add an item
which has text but no image, all of the items become invisible. The toolbar
space shown is the size required to display them.
>
> This is Eclipse 3.5.1. Is this a feechur or a bug?
>
> Regards, John
|
|
|
|
Re: CBanner: I can't mix images and text in Tool Items [message #524625 is a reply to message #524581] |
Thu, 01 April 2010 11:48  |
Eclipse User |
|
|
|
There isn't a difference between using SWT.PUSH and SWT.NONE for ToolItems.
In theory SWT.PUSH is more correct since it's not formally spec'd that
SWT.NONE maps to SWT.PUSH, but in practice this will not change.
Grant
"John Ormerod" <ormeroj@googlemail.com> wrote in message
news:hp28ft$fcd$1@build.eclipse.org...
> Hi Grant
> Much appreciate you taking the trouble to concoct a snippet. Well, yours
works fine (Windows 7). I modified yours to use image files, but it's
always OK.
>
> Then I changed mine to use your drawn image; removed the tool-tip text.
And still mine goes blank when the text-only one is used. I'd used SWT.PUSH,
so I tried SWT.NONE (BTW, I couldn't detect any difference between these -
is there any?).
>
> In the meantime, I had put my CBanner on a Composite and then added
another CBanner for the 'OK' text item. That works OK, and has been deemed
acceptable in that it is visually separate from the items with icons.
>
> I guess it's some wierd difference between the CBanner / ToolBar /
ToolItem being in a raw shell and Eclipse?
>
> I guess as the workaround is OK, I will continue this way. Thanks again.
>
> John
|
|
|
Powered by
FUDForum. Page generated in 0.06109 seconds