Popup windows in docked plugin

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By websterek

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

:bust_in_silhouette: Reply From: gswashburn

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')