Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Changing the height of a CoolBar
Changing the height of a CoolBar [message #484753] Wed, 09 September 2009 07:02 Go to next message
Michael Piefel is currently offline Michael Piefel
Messages: 12
Registered: July 2009
Junior Member
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 14:39 Go to previous message
Michael Piefel is currently offline Michael Piefel
Messages: 12
Registered: July 2009
Junior Member
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
Previous Topic:How To Tie A Toolbar Button To A Specific Perspective?
Next Topic:Databinding text to model
Goto Forum:
  


Current Time: Sat Sep 20 20:15:18 GMT 2014

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

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