Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT Tabfolder update size according to selection
SWT Tabfolder update size according to selection [message #970900] Sun, 04 November 2012 11:59 Go to next message
matus majchrak is currently offline matus majchrakFriend
Messages: 5
Registered: November 2012
Junior Member
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.
index.php/fa/12207/0/
(The ,Results' has FILL_Vertical and grab vertical flags)

and here the second tab.
index.php/fa/12189/0/


Thanks a lot
regards
matus
[edit1]wrong screenshot[edit1]

[Updated on: Tue, 06 November 2012 07:47]

Report message to a moderator

Re: SWT Tabfolder update size according to selection [message #978188 is a reply to message #970900] Fri, 09 November 2012 22:31 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
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 #980174 is a reply to message #978188] Sun, 11 November 2012 12:23 Go to previous messageGo to next message
matus majchrak is currently offline matus majchrakFriend
Messages: 5
Registered: November 2012
Junior Member
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()
index.php/fa/12293/0/

larger child
index.php/fa/12294/0/

am I missing something here?
also is there a way to only accomodate height but not width?

thanks
matus
Re: SWT Tabfolder update size according to selection [message #985685 is a reply to message #980174] Thu, 15 November 2012 16:56 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
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
>
Previous Topic:Can I embed SWT Widgets into webpage
Next Topic:Windows 64 bit XULRunner for 3.6.2?
Goto Forum:
  


Current Time: Sat Apr 20 09:43:46 GMT 2024

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

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

Back to the top