Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Only 1 column of TreeViewer in SashForm should grab new space
Only 1 column of TreeViewer in SashForm should grab new space [message #1612938] Thu, 12 February 2015 09:48 Go to next message
Simon Laffoy is currently offline Simon LaffoyFriend
Messages: 19
Registered: January 2015
Junior Member
HI,

I have a view with a SashForm. In the left panel of the SashForm is a TreeViewer with three columns (each a TreeViewerColumn with a TreeColumn). When I resize the sash form all three columns grab an equal share of the space. What I would like to happen is for only the first column to grab the new space and the second and third column to be unchanged.

I would like the user to have the option to resize the 2nd and third columns if they wish so using the setReziable(false) method of the TreeColumn is not an option.

As a solution I have added a ControlListener to the sash form so that, on resizing, the 2nd and 3rd column keep a constant size. However I am wondering if I can specify which columns may grab space using just the TreeViewer or it's contents, and not by resorting to adding listeners to an outer container.

Thank you

[Updated on: Thu, 12 February 2015 21:07]

Report message to a moderator

Re: Only 1 column of TreeViewer in SashForm should grab new space [message #1613314 is a reply to message #1612938] Thu, 12 February 2015 15:16 Go to previous messageGo to next message
Eclipse UserFriend
Take a look at the JFace TableColumnLayout class with its ColumnWeightData and ColumnPixelData classes. You should be able to use a combination to get the effect you're looking for.

Brian.
Re: Only 1 column of TreeViewer in SashForm should grab new space [message #1613830 is a reply to message #1613314] Thu, 12 February 2015 23:01 Go to previous messageGo to next message
Simon Laffoy is currently offline Simon LaffoyFriend
Messages: 19
Registered: January 2015
Junior Member
Hi, thanks for the advice. Actually I was already using the ColumnWeightData, but switching to ColumnPixelData for the two columns in question fixed their size.

Unfortunately though this has caused an additional and unforeseen problem. If we open our view in Eclipse a horizontal scroll bar will appear at the bottom of the tree viewer. The weighted column is choosing a size exactly 1 pixel too large for the tree viewer. If we expand one of the rows in the tree the horizontal scrollbar disappears. As the treeViewer is in the left hand side of a SashForm, if we attempt to resize the sash the horizontal scrollbar disappears.

Something interesting occurs when I close Eclipse with the view still open. Upon reopening Eclipse the view appears as you would expect, but without the horizontal scroll bar. The view has recreated itself with the first column 1 pixel smaller than if we opened the view manually.

Its also safe to say that this is not related to the sash form as we have now noticed the same horizontal scroll bar in another view of ours without a SashForm.

Unfortunately I have not been able to recreate this error in a simple shell so far, but will keep trying.
Re: Only 1 column of TreeViewer in SashForm should grab new space [message #1615040 is a reply to message #1613830] Fri, 13 February 2015 17:12 Go to previous messageGo to next message
Eclipse UserFriend
Are you specifying a minimum size? When using ColumnPixelData, be sure to use the 3-argument constructor and specify the addTrim argument as true; it's false for backwards compatibility reasons.

Oh, are you using a checkbox? I've had issues with spacing with checkboxes on OSX.

Brian.

[Updated on: Fri, 13 February 2015 17:12] by Moderator

Report message to a moderator

Re: Only 1 column of TreeViewer in SashForm should grab new space [message #1615352 is a reply to message #1615040] Fri, 13 February 2015 22:02 Go to previous message
Simon Laffoy is currently offline Simon LaffoyFriend
Messages: 19
Registered: January 2015
Junior Member
Hi, that didn't work either. There are no checkboxes either.

I have created a new Eclipse Bug including further details of where and how the error occurs and attached code for recreating the problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=459857

[Updated on: Fri, 13 February 2015 22:04]

Report message to a moderator

Previous Topic:StyleText setText cause Out of memory error: Java heap size
Next Topic:Progress Bar with Cancel Button using SWT implementation issue
Goto Forum:
  


Current Time: Wed Apr 24 15:23:14 GMT 2024

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

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

Back to the top