Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fins2thright |
I am using the GraphNode and dynamically adding it to a GraphEdit via drag/drop. Each GraphNode represents some data in an underlying object called Persona. The GraphNode contains a TextEdit, a Label, an ItemList and an invisible WindowDialog.
I use the ItemList within the GraphNode to allow the user to choose actions on the GraphNode (edit or remove).
# this function pops up dialogs based on selections from am item list
func _on_ItemList_item_selected(index: int) -> void:
# Edit the persona information in the node via a popup
if(index == 0):
$PersonaProps.dialogMode = 1
$PersonaProps.inputId = int($lblId.text)
$PersonaProps.popup_centered()
# delete the node after confirmation
if(index == 1):
$dlgConfirm.popup_centered()
When the user chooses Edit from the ItemList (0), I popup a modal WindowDialog where they can update the underlying Persona object. When the user saves the information in the modal dialog and it closes, I emit a global signal that invokes a function in the GraphNode to update the TextEdit and the Label.
(Note that I am doing a lot of print statements for troubleshooting purposes, and the results are all positive, in other words the node contents are updating)
# this function is called by a global signal when the node needs refreshing
func _persona_refresh(personaId) -> void:
print("Refreshing existing Persona :" + String(personaId))
_load_persona(personaId)
# this function reloads the information in the graphnode from the persona object
func _load_persona(personaID:int):
print(String(personaID))
persona = Persona.new()
persona.Open(personaID)
print(persona.persname)
print(persona.persdesc)
$txtDescription.text = persona.persdesc
self.title = persona.persname
$lblId.text = String(persona.id)
My problem is that the new information does not display in the GraphNode after calling _persona_refresh. If I remove the node and re-add it to the GraphEdit, the new information shows up.
I have tried various ways to manually update the GraphNode at the end of the _load_persona function call, including:
- update()
- get_parent().update()
- hide() then show()
- resizing the control
but to no avail. Has anyone else had this issue? What else can I try? Is there something wrong with my architecture?
Thank you for any help you can give.