Changing the height of a CoolBar [message #484753] |
Wed, 09 September 2009 03:02  |
Eclipse User |
|
|
|
I realise this sounds like a pure SWT question at first, but be patient,
it has a second part ;-)
I want to style an SWT CoolBar with a background image. The image is 32
pixels high. The CoolBar has about 24 pixels, or a lot more if I put
text under the icons. How can I force the height of the CoolBar to a
certain value? Using setSize() did not have a visible effect.
Additionally, I don’t even create the bar myself, the ApplicationWindow
creates it from a CoolBarManager. When would be the right time to change
the properties of the CoolBar, or will it be too late? I applied the
background in createContents where I can get the CoolBar control, and
this works.
Bye,
Mike
--
Michael Piefel
netCCM GmbH
|
|
|
Re: Changing the height of a CoolBar [message #486409 is a reply to message #484753] |
Thu, 17 September 2009 10:39  |
Eclipse User |
|
|
|
Michael Piefel schrieb:
> I want to style an SWT CoolBar with a background image. The image is 32
> pixels high. The CoolBar has about 24 pixels, or a lot more if I put
> text under the icons. How can I force the height of the CoolBar to a
> certain value? Using setSize() did not have a visible effect.
One way to do it is the following snippet, assuming you already have
some image:
final CoolBar cool = (CoolBar) getCoolBarControl();
cool.setBackgroundImage(image);
cool.setBackgroundMode(SWT.INHERIT_FORCE);
cool.getItem(0).setMinimumSize(32, 32);
To set the size of the CoolBar, I manipulated the first child. In
addition, I set the image on the CoolBar and force inheritance of the
background.
And where do I do that? In createContents(), I can be reasonable sure
that the CoolBar is already created, so I put those lines there.
Bye,
Mike
--
Michael Piefel
netCCM GmbH
|
|
|
Powered by
FUDForum. Page generated in 0.27492 seconds