I am programming a CYOA-alike in godot using GDScript. I have created a SQL database using the Godot SQLite plugin that contains one table with paragraph IDs and the associated text, and another table that contains the choices presented to the player.
I have written some code that waits for a new paragraph to be displayed on screen, and then looks up all choices associated with that paragraph and iterates through them using a for loop, generating a button for each choice. When the button is clicked, it emits a signal notifying the main scene to display the next paragraph. (This is probably over-engineered but it is not the focus of this question).
So far so good. However, I would like to have the choices change color when moused-over or focused, so that the player can know which choice they are selecting on clicking.
It is trivial to do this when the choices are buttons. Unfortunately buttons don't come with word-wrap, so longer choices were continuing off the screen.
I fixed this by adding code to create a child label for each button. This handles word wrapping, but as labels do not come with a built-in 'on hover' color change, I have now lost the color-change functionality.
My search of the existing Q&A showed how to implement color change functionality for an existing node, but not for a programatically-created one. At this point I'm not sure how to handle.