Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Setting a child of SashForm to a desired size
icon5.gif  Setting a child of SashForm to a desired size [message #543987] Thu, 01 July 2010 05:41 Go to next message
Alexey Romanov is currently offline Alexey Romanov
Messages: 263
Registered: May 2010
Senior Member
EDIT: Sorry, wrong forum Embarrassed

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

Report message to a moderator

Re: Setting a child of SashForm to a desired size [message #544800 is a reply to message #543987] Mon, 05 July 2010 10:11 Go to previous message
Grant Gayed is currently offline Grant Gayed
Messages: 2148
Registered: July 2009
Senior Member
SashForms have public field SASH_WIDTH which you can look at.

Grant


"Alexey Romanov" <alexey.v.romanov@gmail.com> wrote in message
news:i0hns6$gpf$1@build.eclipse.org...
>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.)
Previous Topic:WizardPage - set widthHint of description label (makes the wizard uncomfortable big)
Next Topic:Restore table column user settings
Goto Forum:
  


Current Time: Fri Jul 25 21:21:56 EDT 2014

Powered by FUDForum. Page generated in 0.01810 seconds