0 votes

Hello!

How can I show popup menu from my docked plugin panel.

Right now I have bunch of operations realised after clicking button but one of them need more options and I would like to ask user with popup window.

I'am trying to use simple code where dock is (like in official tutorial) my instanced scene with plugin interface:

func GeneratePaths():
    dock.get_node("Popup").show()
    print('clicked')

here is my tree:
enter image description here

in Engine by (230 points)

1 Answer

0 votes

I used a RMB (right mouse button) option signal and then set the rect_position to my global mouse position. That way the popup menu extended down from where the user clicked. (Context Menu)

$menu/Tree/Menu.rect_position = get_global_mouse_position()
$menu/Tree/Menu.visible = true
$menu/Tree/Menu.popup()

I don't see where you are setting the popup to visible in your code and you are using show() instead of popup(). Try this:

func GeneratePaths():
   dock.get_node("Popup").visible = true 
   dock.get_node("Popup").popup()
   print('clicked')
by (202 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories