You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first up: thanks for creating this library, it's helping me out a ton! :)
I'm using the PopupMenu in my game and have a few problems with it.
I implemented my own Keyboard-Handling and the Popup-Menu is interfering with it.
The StageListener that get's created during the construction of the object also listens to keyDown-Events and handles UP and DOWN-Presses to skip to the next item.
I would like to disable this functionality, but everything that I would need to overwrite is private:
private void createListeners()
private InputListener stageListener
I will use reflections for now, but it would be nice to have an option to disable this out of the box.
If you agree I could create a pull-request to simply make the createListeners-Method protected or create a constructor with a boolean "enableKeyboardSupport" in the constructor which is true by default.
Another thing I noticed is that the "void selectNextItem()"-Method of the PopupMenu runs in an infinite-loop, when you have 2 actors added to the popup that are NOT MenuItems.
private void selectNextItem () {
SnapshotArray<Actor> children = getChildren();
if (children.size == 0) return;
int startIndex = activeItem == null ? 0 : children.indexOf(activeItem, true) + 1;
for (int i = startIndex; ; i++) {
if (i >= children.size) i = 0;
Actor actor = children.get(i);
if (actor instanceof MenuItem && ((MenuItem) actor).isDisabled() == false) {
setActiveItem((MenuItem) actor, true);
break;
}
}
}
It will search for a MenuItem and never find one, so the Game freezes.
Thanks :)
The text was updated successfully, but these errors were encountered:
I think it would be better to have boolean flag along with getter and setter rather than adding yet another constructor argument. Making method protected would be a bad design so let's not do that.
I've noticed more problems with the keyboard selection so I went ahead and fixed it. Probably unlikely case but still, nice catch.
I've also changed how menu's keyboard events are handled. By returning true when action is performed the event won't be passed to the application under the stage. This might actually fix the issue you're having so we might get away with disabling keyboard support.
Hi, first up: thanks for creating this library, it's helping me out a ton! :)
I'm using the PopupMenu in my game and have a few problems with it.
I implemented my own Keyboard-Handling and the Popup-Menu is interfering with it.
The StageListener that get's created during the construction of the object also listens to keyDown-Events and handles UP and DOWN-Presses to skip to the next item.
I would like to disable this functionality, but everything that I would need to overwrite is private:
I will use reflections for now, but it would be nice to have an option to disable this out of the box.
If you agree I could create a pull-request to simply make the createListeners-Method protected or create a constructor with a boolean "enableKeyboardSupport" in the constructor which is true by default.
Another thing I noticed is that the "void selectNextItem()"-Method of the PopupMenu runs in an infinite-loop, when you have 2 actors added to the popup that are NOT MenuItems.
It will search for a MenuItem and never find one, so the Game freezes.
Thanks :)
The text was updated successfully, but these errors were encountered: