0 votes

Hello gyus!
I have a little question about combination with double menu:
I use the: MenuButton like a prent script, and PopupMenu like a child.
How it looks now:
// Script
enter image description here
// View
enter image description here
View how it must to be:
enter image description here
With ability to when I'm select the item from second popup menu, it must be setted to that place if its possible.
enter image description here
Thank you very much gyus! I LOVE YOU ALL - KAPU! xD

asked Nov 6, 2019 in Engine by FinFan (34 points)

My problem is: WHen Im create a popup list, he is not show their elements on my MenuButton popup list. (No arrow, no child elements)

So let me get this straight: if a user clicks on an item from the "countrylist", that item appears in the "villagelist"?

Try to draw the scheme:
enter image description here

Could you please show me how you have laid out the Control nodes (for example, the MenuButton, PopupMenu, and ItemList nodes)? I need to know how one list flows into another list.

It looks like you need GDscript and a signal for when an item of the MenuButton is selected. It could go something like this:

func _ready():
     # Access the "country_menu" PopupMenu through this.
     var country_list_popup_menu: PopupMenu = $country_list.get_popup()
     # Signal for when the user selects an PopupMenu item.
     country_list_popup_menu.connect("id_pressed", self, "_on_country_selected")

 # Function that handles the item selected.
 func _on_country_selected( id ):
       # Code for populating the Dropdown menu or the ItemList. Use the "id" parameter to get which item was selected in the MenuButton.

I donw know what happening, but link ButtonMenu + child PopupMenu - doesnt work correctly if you create them from GUI.
I solve my problem by fully using code for it. Parent MenuButton was created by GUI and child PopupMenu - by code.
$ The problem in log: "node not found", he just can't see a child node if i set them by any ways except New.
1. var node = get_node("sublist") #error not see
2. onready var node = $sublist #error not see
But if you create it by GDScript - no errors all is fine.

SO if any people meet with that problem, the solve looks like:
enter image description here

If you want to do something like that.

Thanks anyway for hearing my call!

Please log in or register to answer this question.

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.