MMenuItem.setSelected is not reflected in the GUI [message #1219049] |
Sat, 30 November 2013 11:05 |
Ozgur Cagdas Messages: 32 Registered: May 2013 |
Member |
|
|
Hi,
I use the below snippet to toggle selected states of DirectMenuItems and via debugger I can verify that the fields are modified as expected. However, the changes are not reflected in the GUI and initial selections states are retained as far as the GUI is concerned.
Am I missing anything here?
Another question is, I tried getting the MMenu which holds this MMenuItem injected in the execute method (both @Named and regular injections) but every time I'm getting 'null'. I worked this around by accessing the parent of the MMenuItem but why wouldn't the injection work?
@Execute
public void execute(MMenuItem item) {
MElementContainer<MUIElement> elementContainer = item.getParent();
List<MUIElement> uiElements = elementContainer.getChildren();
for(int i = 0; i < uiElements.size(); i++) {
MUIElement uiElement = uiElements.get(i);
if(uiElement instanceof MMenuItem &&
((MMenuItem)uiElement).getType() == ItemType.CHECK) {
((MMenuItem)uiElement).setSelected(false);
}
}
item.setSelected(true);
}
Regards,
Ozgur.
[Updated on: Mon, 02 December 2013 21:38] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02707 seconds