How can I change the GWT menu - some gray items, check a box next to others, according to the state of my application?
My application has a menu bar at the top - "File", "Edit", "View", "Insert", "Format", etc. I have several paragraphs, each of which may have a different format. When the user clicks on "Format", I want the checkmark next to the menu item that matches the format of the currently selected paragraph to be displayed in the format menu. If some formats are not suitable for the currently selected paragraph, I want these menu items to be gray.
The main problem is when to update: (a) when you click the Format button, or (b) every time my user selects a new paragraph?
I find option (a) more attractive. But how can I detect this? Menu MenuItem does not have the ability to add event listeners. It may be the mouseClick that I need, but it may be mouseOver: if the user clicks on the Insert menu item, the Insert menu appears, but then, if the mouse moves through formatting, the Format menu appears.
Option (b) sounds easier, but spends more time on the processor.
For my Menu context (right-click on a paragraph) this is much simpler because the menu is only created when right-clicking.
(& # 8730) . - ? HTML " " ?
, () , ?