Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsSetting a child of SashForm to a desired size
https://www.eclipse.org/forums/index.php/mv/msg/171105/543987/#msg_543987
]]>Alexey Romanov2010-07-01T09:41:25-00:00Re: Setting a child of SashForm to a desired size
https://www.eclipse.org/forums/index.php/mv/msg/171105/544800/#msg_544800
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.)]]>Grant Gayed2010-07-05T14:11:08-00:00