0 votes

Essentially, I am trying to create a to-do list feature in Godot. I'm only 1 month into my game development journey and I'm beginning to become more serious. I learned it is a good idea to use lists to keep track of what you have to do in game dev, and this helps you stay organized and focused. I thought instead of just using one of the many programs that allow to-do lists, I could make my own in Godot which could be a fun new challenge that would help me learn. I started off with a simple 2D scene and created a background in a TextureRect, and also a LineEdit to allow user input to add to the lists. I created an ItemList where the list will be displayed and autoloaded that node. I connected a signal from LineEdit to a script that calls the add_to function in the ItemList script.

extends LineEdit                                                            func _on_LineEdit_text_entered(new_text: String) -> void:
  GlobalItemList.add_to(new_text)

This is how I am doing the user input. The code from the Item List script is as follows.

extends ItemList                                                             func add_to(text):
   self.add_item(text)
   print(text)

At first, I would type something and enter it and nothing happened so I added the print to see if it was actually getting my input and it works, the text I enter is displayed in console. My question is how do I get it to display in a list, with each new item entered on a new line. Also, with the whole checking off items on a list part of the to-do list, I have no clue where to get started. I want either a checkbox next to every item on the list or allow for the text to be clicked on and then a line is drawn through it, how would I do something like that. Please help. Thank you.

asked Jun 30 in Engine by Kad Gaming (12 points)

1 Answer

0 votes

I would use a VBoxContainer to wrap the LineEdit objects. A HBoxContainer around that container would allow you to create multiple nested VBoxContainers for adjacent CheckBox buttons (or however many associated buttons/features per to-do list item you desire). A pair of Buttons with \/ and /\ could be useful to send an item up or down the list.

You should be able to reorder a VBox's contents by reordering its children via move_child(self, index).

Not sure how you would do a strikethrough on a LineEdit. From my understanding, that's more suitable fora RichTextLabel, but that makes getting input on them impossible. Perhaps one LineEdit at the top, with a Submit button that moves the input string down into a list of RichTextLabels, which can then be marked as completed and struckthrough? Infinite complexity is possible for any project.

answered Jul 1 by DDoop (395 points)
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.