|Disable scrolling in MasterDetailsBlock [message #326038]
||Thu, 06 March 2008 02:39
| Cameron Bateman
Registered: July 2009
I am trying to create a master-detail form using the MasterDetailsBlock. |
The problem I am encountering is that the IManagedForm uses ScrolledForm
rather than Form. The result is that my master block, which consists of a
large tree viewer, causes the entire master-detail block to scroll when it
gets large. This causes the detail page, which is much smaller, to be
completely outside the view port when I select items far down in the Tree
that I want to display details for... which kinds of defeats the point of
the details block.
What I would prefer is that the ScrolledForm maintain an FILL_BOTH type of
behaviour in its container (a ViewPart), but allow the tree in the master
to scroll. However, I can't seem to configure the ScrolledForm to not
scroll in the vertical. When I set setExpandVertical(false), for example,
things improve, but when I click on the expanded state of a Section in the
detail part, it resizes the tree and everything goes loopy.
To summarize, I'd like the tree view in the master part of my
MasterDetailsBlock to be able to resize to its container, but I want it to
scroll, not the whole MasterDetailsBlock if it gets too big for the view
|Re: Disable scrolling in MasterDetailsBlock [message #548509 is a reply to message #326038]
||Thu, 22 July 2010 04:32
Registered: June 2010
I have also run into this issue.|
What I eventually discovered is that this seemed to only happen when creating the MasterDetailsBlock inside of a ScrolledPageBook (or any PageBook for that matter). When a changed the ScrolledPageBook to a CTabFolder, everything started working as expected. The table now has the scrollbars and the MasterDetailsBlock does not.
I still don't quite know why this is. Perhaps someone else has some more insight.
In playing with the CTabFolder, I soon discovered this only solved the problem in the initial display of the form. A reflow(true) on your scrolledForm will eventually cause the table to expand without scrollbars, and the scrollbars will instead appear on the form itself. This reflow can occur automatically, for example, when setting the text of the form.
I then stumbled upon the solution. You must provide a width and height hint in the layout data assigned to the table (or tree) that you wish to be properly scrolled. The values you set as the hints will effectively be the minimum size of the table before the scrolled form starts displaying scrollbars.
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 500;
gd.heightHint = 120;
After setting the hint on my grid data, I went back to using a ScrolledPageBook with no issues.
[Updated on: Thu, 22 July 2010 14:35]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01665 seconds