whiskers icon indicating copy to clipboard operation
whiskers copied to clipboard

Use MenuButton instead of custom controls

Open Awkor opened this issue 6 years ago • 1 comments
trafficstars

Currently the menu bar buttons use custom controls to achieve a similar behavior to MenuButton.

Here's how the MenuButton looks like in the Godot editor: 20190210

We should consider using the MenuButton node because it would:

  • Simplify the tree scene (the addition of menu items is done through code)
  • Ease the handling of shortcuts (MenuButton uses a PopupMenu which allows to specify a ShortCut to each item)
  • Remove the need to manage the opening and closing of each menu (it's handled by default)
  • Allow to use the switch_on_hover property

The only caveat is that there's currently an issue that hides a menu item label when a shortcut is set.

Thoughts?

Awkor avatar Feb 10 '19 15:02 Awkor

I agree that we should switch to MenuButton, however that bug you linked looks like it could cause some headaches, and isn't slated to be fixed until 3.2 which is a little concerning.

I'm curious if there is an easy workaround so that we can switch to the MenuButton button nodes and still add shortcuts. I also wonder if the bug is only in effect when programmatically adding items / labels?

yochrisbolton avatar Feb 10 '19 17:02 yochrisbolton