Label not registering events the dimension > device height

24 views
Skip to first unread message

Carlos Verdier

unread,
Apr 17, 2018, 9:12:23 AM4/17/18
to CodenameOne Discussions
Hi

This is happening only on Android, where it used to work fine.
In the following test case, a Label stops registering events when its dimension is overriden and Label's height > device's height.

Could you please take a look? Thanks

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        screenOne();
    }
    private void screenOne() {
        Form f = new Form(new BorderLayout());
        /*
        NOT REGISTERING EVENTS WHEN DIMENSION > DEVICE HEIGHT
        */
        Label lbl = new Label() {
            @Override
            public void pointerReleased(int x, int y) {
                super.pointerReleased(x, y);
                Dialog.show("Event", "Touched", "Ok", "Cancel");                
            }
            @Override
            protected Dimension calcPreferredSize() {
                return new Dimension(getDisplayWidth(), getDisplayHeight() + 120);
            }            
        };
        Container contY = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        contY.setScrollableY(true);        
        contY.setScrollVisible(false); 
        contY.add(lbl);
        f.add(BorderLayout.CENTER, contY);
        f.show();
        
    }



Carlos Verdier

unread,
Apr 17, 2018, 10:35:37 AM4/17/18
to CodenameOne Discussions
Ok, it's working fine with android.buildToolsVersion=27 so maybe it's not worth the fix anyway...

Shai Almog

unread,
Apr 18, 2018, 1:14:28 AM4/18/18
to CodenameOne Discussions
It shouldn't get events at all in any platform.
Labels aren't focusable and shouldn't get events. You should use a Button. You can give it a Label UIID to make it look like a label.
Reply all
Reply to author
Forward
0 new messages