Tabs + BoxLayout Y not working now

43 views
Skip to first unread message

Carlos Verdier

unread,
Jun 23, 2016, 5:22:22 PM6/23/16
to CodenameOne Discussions
Hi

Mi app was working fine yesterday, or maybe the day before, I don' t remember exactly. Now it's having problems with the following configuration:

Tabs containers, each one of them containing BoxLayout Y containers to scroll vertically. As I said, this was working smoothly but all of the sudden it's failing on Android and iOS. Still working fine on simulator and Mac OS X desktop. I simply can't scroll vertically, if I try they are blocked and the containers next to the current tab are the ones moving instead.

I have built a test case so you can see what is happening. It is much worse on my app, but still you can see the effect here. Just play a bit swiping between tabs and scroll the containers as well, leave the moving and swipe fast. I hope you can see the problem...

ps. I have built against 3.4 but the problem is still there.

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form f = new Form(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));  
        Tabs t = new Tabs();
        for (int x = 0; x < 3; x++) {
            Container cont = new Container(new BoxLayout(BoxLayout.Y_AXIS));
            cont.setScrollableY(true);    
            for (int i = 0; i< 3; i++) {
                Label l = new Label() {
                    @Override
                    protected Dimension calcPreferredSize() {
                        return new Dimension(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
                    }                    
                };
                FontImage.setMaterialIcon(l, FontImage.MATERIAL_ADD_A_PHOTO, 20);                    
                cont.add(l);                
            }            
            t.addTab("", cont);
        }
        f.addComponent(BorderLayout.CENTER, t);
        f.show();
    }



Shai Almog

unread,
Jun 24, 2016, 12:50:43 AM6/24/16
to CodenameOne Discussions
Hi,
we try to stick to updating only on Fridays and this week we were successful. No updates were made for the servers until later today.

If the problem happens in 3.4 it's because of a change you made to the code as that is static.

Looking at the code you should not use that center behavior for a UI of the type you chose. It shouldn't have worked to begin with.
When we say border layout CENTER we always mean the default behavior which is scale unless explicitly stated otherwise...

Carlos Verdier

unread,
Jun 24, 2016, 3:55:53 AM6/24/16
to CodenameOne Discussions
Yes, you're right, sorry.

I found the problem. Apparently, I wrote t.setEagerSwipeMode(true) to test the behavior and totally forgot about it! It is working as expected now.

Yesterday I was too tired, it was late and I was unable to see a trivial error like that. My mistake :)

Thanks

Carlos Verdier

unread,
Jun 24, 2016, 4:26:51 AM6/24/16
to CodenameOne Discussions
Anyway, I think I found an odd behavior with the configuration in the test case. Forget about center behavior, it can be changed and the issue persists. To reproduce it, just scroll Y containers freely and before it stops scrolling, swipe to another tab. Now try to scroll the current containers, and you'll see that they are blocked. 

Not a big problem to me because I make use of setSnapToGrid(true) which prevents this from happening. But I just wanted to let you know...

Shai Almog

unread,
Jun 25, 2016, 2:12:20 AM6/25/16
to CodenameOne Discussions
I don't understand how I can reproduce this. If I scroll down and then swipe the scrolling is effectively stopped.

Carlos Verdier

unread,
Jun 25, 2016, 4:31:46 AM6/25/16
to CodenameOne Discussions
It's not easy to explain... Steps to reproduce:

In Tab1, scroll down, release and before it stops scrolling, swipe to next tab
In Tab 2, try to scroll down. You won't be able because the scrolling is affecting Tab1 even when you are trying to scroll in Tab2.

I've uploaded a video where you can clearly see the problem

Shai Almog

unread,
Jun 26, 2016, 1:03:11 AM6/26/16
to CodenameOne Discussions
Odd, thanks. Can you file an issue one that, we'll have to give it a deeper look.

Carlos Verdier

unread,
Jun 26, 2016, 6:05:13 AM6/26/16
to CodenameOne Discussions
Ok, done.
Reply all
Reply to author
Forward
0 new messages