|
Re: SWT Tabfolder update size according to selection [message #978188 is a reply to message #970900] |
Fri, 09 November 2012 22:31 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi,
TabFolder.pack() should do this, but this isn't working in a little test
snippet that I just tried. I'll look into whether there's a bug here,
but in the meantime I notice that changing the TabFolder to CTabFolder
results in CTabFolder.pack() behaving as expected, so at this point my
suggestion is to make this change.
Grant
On 11/4/2012 7:05 AM, matus majchrak wrote:
> Hi,
>
> I have a ViewPart with GridLayout and two children: Tabfolder and Table. In tabfolder I have two TabItems of different height. Is it possible to resize the tabfolder according to the height of the selected tab?
>
> Here are some screens. First the part with ,,smaller'' tab selected - I want to get rid of the blank space.
>
> (The ,Results' has FILL_Vertical and grab vertical flags)
>
> and here the second tab.
>
>
>
> Thanks a lot
> regards
> matus
>
|
|
|
|
Re: SWT Tabfolder update size according to selection [message #985685 is a reply to message #980174] |
Thu, 15 November 2012 16:56 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
I see, I overlooked that part of your question. The implementation of
CTabFolder.pack() asks each of its tabs for its preferred size, so even
tricks like making the content of non-visible tabs invisible will not
help here. One thing you could try is to set the size (or if you're
using layouts, the size hints) for all controls on non-visible tabs to
1,1, so that their preferred sizes will become very small. Then fix
these sizes (or in the case of layouts, get rid of the size hints) for a
given tab when it is selected.
That being said, having a tab folder whose size changes on every tab
selection is not typical, and may seem jumpy to the user. Just a
suggestion to re-consider whether this is actually a good thing to do.
Grant
On 11/11/2012 7:23 AM, matus majchrak wrote:
> Hi Grant,
>
> thanks a lot for your suggestion but in my case the results are not quite what I expected.
> I switched the TabFolder to CTabfolder and in selection listener I added the pack request.
>
> searchCriteriaTabFolder.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> searchCriteriaTabFolder.pack();
> }
> });
>
> now the tabfolder did pack its contents, but still only to the size of the largest child.
> here are the screenshots:
> smaller child after pack()
>
>
> larger child
>
>
> am I missing something here?
> also is there a way to only accomodate height but not width?
>
> thanks
> matus
>
|
|
|
Powered by
FUDForum. Page generated in 0.04230 seconds