Hello,
ive got a problem with the niftyPopupMenu, the MenuItemActivatedEvent isnt fired.
[java] public void bind(Nifty nifty, Screen screen) {
Element popup = nifty.createPopup(“niftyPopupMenu”);
Menu<Object> popupMenu = popup.findNiftyControl("#menu", Menu.class);
popupMenu.setWidth(new SizeValue(“100%”)); // this is required and is not happening automatically!
popupMenu.addMenuItem(“MenuItem 1”, null, “bbb”);
popupMenu.addMenuItemSeparator();
popupMenu.addMenuItem(“MenuItem 2”, null, “bbb”);
popupMenu.setId(“dddddddd”);
nifty.subscribe(screen, popup.getId(), MenuItemActivatedEvent.class, new EventTopicSubscriber<MenuItemActivatedEvent>() {
public void onEvent(String string, MenuItemActivatedEvent t) {
System.out.println(string);
}
});
nifty.showPopup(screen, popup.getId(), null);
}[/java]
after clicking on a menuitem the console says “INFO: ← unsubscribe element [2] [2] → [de.lessvoid.nifty.Nifty$ClassSaveEventTopicSubscriber@45c97b{2}{null}{class de.lessvoid.nifty.controls.MenuItemActivatedEvent}]”
That looks pretty much identical to my setup.
What version of nifty are you using? I believe the pop up menu was broken with the 1.3 release but it got fixed a couple of weeks ago.
http://hub.jmonkeyengine.org/groups/gui/forum/topic/nifty-menuitemactivatedevent/
thank you :), but where do i get the nifty-default-controls-1.3.1-20110716.000234-9.jar ?
In the Nifty Maven Repo you can find the nightly builds of Nifty:
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-default-controls/1.3.1-SNAPSHOT/?C=M;O=D
hello,
im using the newest nifty 1.4 but dont get any menuitemactivated events.
the code of the menu popup is the same.
no errors or warnings are printed
hello, .
i thought that the bug was fixed in all new versions of nifty but its only in
nifty-default-controls-1.3.1-20110716.000234-9.jar. in newer versions of nifty the bug is still present.