I want to make a search engine that looks for items in a Sqlite database and present each time 25 results per page, the results are created at runtime, and the items are children in a VBoxContainer. found the solution:
var key = data.keys()[i]
var newItem:HBoxContainer = HBoxContainer.new()
#newItem.size_flags_horizontal = 3
#newItem.size_flags_vertical = 3
newItem.anchor_left = 0
newItem.margin_left = 0
newItem.anchor_right = 1
newItem.margin_right = 0
newItem.rect_min_size.y = 154
newItem.set("custom_constants/separation", 20)
$ScrollContainer/Result_Items.add_child(newItem)
newItem.connect("gui_input", self, "_item_was_clicked",[key]);
I'm sending the key with the signal function [key], this way I know which item in the Dictionary was clicked.