I cannot get menu items to checked or unchecked dynamically when a user clicks them in a menu. Here's the code, it doesn't work and I cannot figure out any other way to do this.
Code:
// Note: viewHeader is a boolean class variable... MenuItemIfFunction headerIfFunc = new MenuItemIfFunction() { public boolean execute(Canvas target, Menu menu, MenuItem item) { return (viewHeader); } }; com.smartgwt.client.widgets.menu.events.ClickHandler menuItemClickHandler = new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { viewHeader = !viewHeader; } }; final MenuItem headerMenuItem = new MenuItem("View Email Header"); headerMenuItem.setCheckIfCondition(headerIfFunc); headerMenuItem.addClickHandler(menuItemClickHandler); Menu menu = new Menu(); menu.setShowShadow(true); menu.setShadowDepth(10); menu.setItems(headerMenuItem); MenuButton menuButton = new MenuButton("Email Options", menu); menuButton.setWidth(100); menuButton.setHeight(20); menuButton.setPrompt("Configure email options"); menuButton.setHoverWidth(10); menuButton.setHoverWrap(Boolean.FALSE);
Comment