Right side Button with side menu

80 views
Skip to first unread message

darkgaro

unread,
Aug 3, 2013, 10:42:23 PM8/3/13
to codenameone...@googlegroups.com
I am trying to add the a button to title of the form when sidemenu is enabled. 
    public void postShow(Form f) {

        Button btn = new Button(null, fetchResourceFile().getImage("add_40.png"));
        btn.setUIID("TitleButton");
        btn.setTextPosition(Button.TOP);
        f.getTitleArea().addComponent(BorderLayout.EAST,btn);
        f.getTitleArea().revalidate();
         
    }
    
When code is run , you can see the form transitioning and with it the button but as soon as transition is finished the button disappears. 

I have tried adding it to beforeShow as well but same thing happens.

Not sure if I am doing it correctly or if there is some other way. 

Thanks 

Shai Almog

unread,
Aug 4, 2013, 3:02:33 AM8/4/13
to codenameone...@googlegroups.com
This isn't supported functionality and there is a warning about that in the JavaDoc for title area.
We manipulate the title area quite heavily for the command feature so relying on it just won't work.

The only way you can manipulate the title area is by creating your own menu bar and that means getting deep into the code.

Regardless this won't work correctly in the default Android implementation where we use the ActionBar.
Reply all
Reply to author
Forward
0 new messages