CheckBox and RadioButtons in a Menu?

Hello,

we are currently evaluating Vaadin as our framework and are wondering if there exists some way to have checkboxes and RadioButtons in the menu bar ?

So far I did only see menu->submenu->separators and Icons.
But I don’t see a way to have a RadioButton style group in the menu,
nor do I see a way to “Check” a menuentry.

André

I’m afraid that MenuBar does not support such functionality at the moment, but I’ve implemented radiobutton-like menus using the icons supported by menuitems. It was pretty straightforward, just track the “radiobutton” state when user activates the menu commands, and assign “on” or “off” icon to the menuitems as appropriate when the state changes. It would be easy to simulate checkboxes in the same way too.

Good idea, I think that will do the job.

We don’t use the RadioButton menu items very often,
but the Checkboxes (or Selected) are widely used by us.

Thanks

André

The “selected” behavior should be included in the default MenuBar implementation,
worth a ticket
.

I think the “radio button” behavior is best left to be handled by the developer with custom logic.

“Requested” :smiley:


http://dev.vaadin.com/ticket/4125

Thanks for the ticket. A good as well ticket, I might add :slight_smile:

Hi…this would be like a toggle menu item?..was this implemented?

regards,

Hugo

Yes, see MenuItem.setCheckable(boolean).