Side menu kills layout of title component in Toolbar?

48 views
Skip to first unread message

Timo van de Put

unread,
Feb 24, 2015, 3:17:38 AM2/24/15
to codenameone...@googlegroups.com
I have added a Container with a 3-column GridLayout as the title component in the Toolbar, which lays out nicely across the full width of the form.

But when I add a command using:

getToolbar().addCommandToSideMenu(new Command("Command"));

then the title component is suddenly reduced to its minimal dimension. The Component Tree Inspector confirms that there is plenty of space, but my grid container is now at its Preferred Size.

When (instead of the command) I add a regular button using:

getToolbar().addComponent(Borderlayout.WEST,new Button("Button"));

then the layout does behave as expected.

What is going on here, and how do I prevent it from happening?

Thanks

.

Chen Fishbein

unread,
Feb 24, 2015, 4:34:54 AM2/24/15
to codenameone...@googlegroups.com
Can you share a screenshot? it's not clear what you are experiencing

Timo van de Put

unread,
Feb 24, 2015, 4:48:48 AM2/24/15
to codenameone...@googlegroups.com
The attached screen shots from the CN1 simulator demonstrate my explanation above:
  • "spaced.png" shows what happens if a button is placed in the WEST position of the Toolbar. (This is what I expect the BorderLayout of the Toolbar to do.)
  • "compressed.png" shows what happens when the side menu icon is added to the Toolbar.
Somehow the size of my title component (a container) is being influenced by the hamburger control of the side menu.

How can I prevent this from happening?
spaced.png
compressed.png

Chen Fishbein

unread,
Feb 24, 2015, 5:02:21 AM2/24/15
to codenameone...@googlegroups.com
Hi,
Add leftAlignSideMenuBool=true to the theme constants.

Reply all
Reply to author
Forward
0 new messages