Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Tabs: with tabs at BOTTOM and long contentPane, tabs disappear and contentPane is not scrollable #285

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In Tabs, when you place the tabs at the bottom of the screen, the default 
behaviour is not right. 

[Issue A] If the contentPane is larger than the containing Form allows, then 
the tabs disappear below the screen, and the contentPane is not scrollable. If 
you make the containing Form scrollable, then Furthermore, if one of the tabs 
have a very long content, then the content of the other tabs are placed in the 
middle of the contentPane, which make it appear in strange places. In the 
example below, the "Tab2 label" is not visible on Tab2. 

[Issue B] If the Tabs contentPane does not fill the entire screen, the tabs are 
placed below the contentPane instead of at the bottom of the containing Form. 

The default behaviour should place the tabs at the bottom of the containing 
form, and the Tabs contentpane (bot NOT the tabsPane) should be scrollable so 
you can scroll up and down contentPanes that are longer than the Form. 

What steps will reproduce the problem?
1. For [Issue A] run the below code. For [Issue B], change numberLabels to  eg 
5. 

What is the expected output? What do you see instead?
[Issue A] The tabs disappear (below the screen) and the contentPane is not 
scrollable, so no way to do anything. When clicking on Tab2, the label "Tab2 
label" should be visible.
[Issue B] The tabs should be place at the bottom of the form, instead they 
appear somewhere on the middle of the screen. 

I guess Tabs can be tweaked to get the expected behaviour, but it should 
provide the most commonly expected  behaviour by default.  

What version of the product are you using? On what operating system?
Trunk revision 372. Windows 7 32 bit, Netbeans 7.2 with plugin 1.0.16. Using 
the Simulator. 

Please provide any additional information below.

Tabs tabs1 = new Tabs(Component.BOTTOM);
Container container1 = new Container(new BoxLayout(BoxLayout.Y_AXIS));
int numberLabels = 40;
for (int i = 0; i < numberLabels; i++) {
    container1.addComponent(new Label("Label " + i));
}
tabs1.addTab("Tab1", container1);
tabs1.addTab("Tab2", new Label("Tab2 label"));
Form form = new Form();
form.addComponent(tabs1);
form.setScrollable(false);
form.show();

Original issue reported on code.google.com by ch.hj...@gmail.com on 4 Aug 2012 at 8:50

GoogleCodeExporter commented 9 years ago
Use
form.setLayout(new BorderLayout());
form.addComponent(BorderLayout.CENTER, tabs1);

Original comment by shai.almog on 4 Aug 2012 at 9:02

GoogleCodeExporter commented 9 years ago
Thanks for fast response. Unfortunately it still doesn't work as needed: if I 
scroll the contentPane (with "Label x") then the tab pane (with "Tab1") also 
scrolls away and becomes invisible. You expect the tab pane to stay fixed at 
the bottom of the screen and only the contentPane to scroll. 

Original comment by ch.hj...@gmail.com on 4 Aug 2012 at 10:50

GoogleCodeExporter commented 9 years ago
You need:
container1.setScrollableY(true); 

Otherwise you are creating a huge non-scrollable container and there is no 
sensible way to lay it out.

Original comment by shai.almog on 4 Aug 2012 at 12:59

GoogleCodeExporter commented 9 years ago
Thanks for your help, and sorry for reporting an invalid bug. I only did it 
instead of using the forum, because I thought such a simple example should work 
and it had to be an error.  

The whole layout thing is not intuitive and I haven't found good documentation 
helping me get a solid mental model I can use. Every time I try to get the 
layout I need, I tend to end up spending hours on trial and error. 

Original comment by ch.hj...@gmail.com on 4 Aug 2012 at 5:46

GoogleCodeExporter commented 9 years ago
We know its a bit complex sometime and has a high learning curve. That's mainly 
why we recommend the GUI builder where its easy to play around with the various 
cases.
I wrote quite a bit about these in the developer guide, if you think something 
specific wasn't mentioned feel free to let us know.

Original comment by shai.almog on 4 Aug 2012 at 6:49