@DanielC said:
Thank you TwistedTwigleg! Indeed the min size for the ScrollContainer did work to show the instances.
I applied the code and managed to create instances of the scene inside the node.
Great! I'm happy that I was able to be of some help.
But yet, again I got stuck. This time with connecting the button signals. In the v_a.tscn scene I have two buttons called TextureButton_plus and TextureButton_minus. Both have a signal to the Controll node, called v_a_controll.
Looking at the code, and the node structure, the issue is probably the NodePath you are using. For instance, I believe line 8 should use the following:
get_node("VBoxContainer/HBoxContainer2/TextureButton_plus").connect("plus_ingedrukt", self, "plus_ingedrukt_ontvangen")
All I did was change the NodePath so that it points to the correct node in the node tree. The get_node
function needs the full path to the node you want to get, relative to the node the script is attached to. Since the script is attached to Main
, you'll need to add all of the nodes in between Main
and TextureButton_plus
to the NodePath.
And the second problem I have got is how to do the processing of the information.
...
But I have no clue on how to fit everything together. Because the number of instances will get big.
Renaming the instances is one way to differentiate between instances. Personally, I would store all of the instances into a single list/array and use the index to differentiate between them, but there is nothing wrong with using the name instead. Do whatever works best for you and your project :+1:
As for storing the data, in theory you just need to do something like this:
var instance = node_to_save_date_from
dictionary_name[instance .name] = instance .variable_to_store
Or if you need to store more than a single variable, you can either use a dictionary or a list. For example, using a dictionary:
var instance = node_to_save_date_from
var sub_dictionary = {}
# Example data:
sub_dictionary["name"] = instance.name;
sub_dictionary["color"] = instance.color;
sub_dictionary["shape"] = instance.shape; #etc.
dictionary_name[instance .name] = sub_dictionary
Of course, it the best way to store the data depends on what data you are trying to store and your personal programming preferences. The key is just to use a consistent method for storing and retrieving the data to/from the dictionary you are using.
Hopefully this helps!