Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 9:43 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sat Mar 03, 2012 8:54 am 
Offline

Joined: Thu Aug 11, 2011 7:24 pm
Posts: 17
Hi all,

I create a tabbed pane in a ResizableFrame, with a button below, all patterned by a layout. However, when I resize the frame, the content of the tabbed pane doesn't resize itself, even with the layout. How can I manage to do that ?
When I create only a scrollpane without tabbed pane, that works. I don't understand why.

FaZeGA


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 9:03 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1172
Well - in the Source Viewer Demo is also a TabbedPane with several TextArea widgets inside - these resize correctly. I also couldn't see anything in the code which would prevent resizing of the tab content.

Can you post code?

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 12:13 pm 
Offline

Joined: Thu Aug 11, 2011 7:24 pm
Posts: 17
Sorry, that is my code :

Code:

DialogLayout globalLayout = new DialogLayout();
globalLayout.setTheme("/dialoglayout");

TabbedPane tb = new TabbedPane();
tb.setTheme("/tabbedpane");

DialogLayout layout = new DialogLayout();
layout.setTheme("/dialoglayout");
      
for(int i = 0; i < tileSlots.size(); i++)
{
   for(int j = 0; j < tileSlots.get(i).size(); j++)
   {
      layout.add(tileSlots.get(i).get(j));
   }
}
      
ScrollPane scrollPane = new ScrollPane(layout);
scrollPane.setTheme("/scrollpane");
       
tb.addTab("Sols", scrollPane);


Button newTypeButton = new Button("Nouveau type ...");
newTypeButton.setTheme("/button");
   
      
globalLayout.setHorizontalGroup(globalLayout.createParallelGroup(onglets, newTypeButton));
globalLayout.setVerticalGroup(globalLayout.createSequentialGroup(onglets, newTypeButton));
      
this.add(globalLayout);


"this" returns the resizableFrame that contains the tabbed pane and the button.


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 12:53 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1172
Your "layout" is incomplete - you added widgets (which is not required) but did not setup the horizontal and vertical groups - so it will not perform any layout operations.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 4:24 pm 
Offline

Joined: Thu Aug 11, 2011 7:24 pm
Posts: 17
Yes, but the widgets I add have a particular position : it's like the inventory panel actually.

And it works without the button ...


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 6:59 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1172
If you do manual layout then you don't need DialogLayout - but if you use DialogLayout you need to use it's groups.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Fri Jul 06, 2012 9:19 pm 
Offline

Joined: Thu Aug 11, 2011 7:24 pm
Posts: 17
So, can you show me a code that works ? It's juste like the inventory panel example, but in a tabbedpane, with a scrollpane and a button beneath.


Top
 Profile  
 
PostPosted: Fri Jul 06, 2012 10:22 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1172
Your code is adding widgets (from the tileSlots array) to the DialogLayout, but does not add them to any groups (as I already said).
Which in turn means that the DialogLayout is incomplete and will not do any kind of layout work.
Your TabbedPane asks it's content (the DialogLayout) for it's minimum, preferred and maximum size - but as the DialogLayout is incomplete it will return 0.

And if you read through the InventoryPanel class, you will see that it doesn't use DialogLayout but does it's layout and preferred size computation. While your code uses a DialogLayout without providing layout groups.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group