I'm making a to-do-list system, and i want to be able to edit list items once they've been created. For that, i made a "Form" scene where i can write/select/check/choose stuff, and i want that form to appear when i chose to edit an item, and disappear and return the data that was entered by the user when i click a "confirm" button.
I'm not of what would be the best way to do that. Here is my current idea:
- The form scene can send a custom "confirmed" signal containing data grabbed from the form.
- When i click edit on a list item, a function create an instance of the form scene, and connect to it's "confirmed" signal.
- the user can do whatever they want with the form.
- when they click the "confirm" button, the "confirmed" signal is emitted, and the form disappear
When the list item receive the "confirmed" signal carrying the data, it adjust itself accordingly.
This seems to work okay, but i'm not satisfied by the fact that it requires connecting/deconnecting signals and differents function to open the form and get the data, which might get messy if i add new things to the system, or if i try to do something similar in an other context.
I want to know if this is a good/bad way of doing it, and if they are better ways to achieve my goal.
I'm imagining a function that open the form, let the user changes things, then grab the data and return it/edit the item when confirmed is clicked on the form.
But i have no idea how to achieve something similar, and i wonder if it's even possible/good practice to have a function "wait" for a button click like that.
I'm new to godot, so i'm open to any comment even vaguely related to my issue.
Thanks in advance