Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting a child of SashForm to a desired size
Setting a child of SashForm to a desired size [message #543990] Thu, 01 July 2010 09:47 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I have a piece of code which looks like this:
SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
Composite mainPart = new Composite(sashForm, SWT.NONE);
Composite second = new Composite(sashForm, SWT.NONE);
sashForm.setWeights(new int[] {1, 0}); // normally the second child should be hidden
// ...
int totalHeight = sashForm.getSize().y;
int desiredHeightOfSecond = ...;

sashForm.setWeights(new int[] {totalHeight - desiredHeightOfSecond, desiredHeightOfSecond});

However, this results in a bit smaller height than wanted, presumably because totalHeight includes the thickness of the separator. How can I find this thickness? Or is there a simpler way to achieve what I want? (I've tried using second.setSize(), but couldn't get it to work despite trying different combinations of pack and layout.)

[Updated on: Thu, 01 July 2010 09:49]

Report message to a moderator

Re: Setting a child of SashForm to a desired size [message #544397 is a reply to message #543990] Fri, 02 July 2010 14:44 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,
SashForm.getSashWidth() returns the width of the sash (separator).

HTH,


Lakshmi P Shanmugam
Re: Setting a child of SashForm to a desired size [message #544400 is a reply to message #544397] Fri, 02 July 2010 14:50 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Can't think how I missed that Embarrassed
Previous Topic:Tooltip for multi-column TreeViewer
Next Topic:WordPad in SWT application
Goto Forum:
  


Current Time: Fri Apr 19 20:07:01 GMT 2024

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

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

Back to the top