i have a Widget that represents my Singeplayer Game Creation Menu.
I list the savegames there. I get all Savegames in the Construct node of the Singleplayer Menu and create a new Widget called “Savegame” for each. They are set as a child of a Vertical Box inside a Scrollbox.
This all works fine.
Now my problem:
The Savegame Widget has a Button to delete the Savegame. This is working too, but i can’t get the Widget removed from the Singleplayer Menu. Its only gone if i go out of the menu and go back in (so only if construct is called again).
For the button i tried several things. I used the remove from viewport node for the Savegame widget. I got the Parent of the widget and removed it child (self), but nothing is working. The Widget stays activ until i reload the Singleplayer Widget. Is there a method to reload a widget or why is the Savegame widget not disappearing?
This may have no bearing on your issue … but I was just doing something like that. I used Add To Viewport and Removed From Viewport for the widget in GameState and that worked. Your calls to SaveGame probably should also be in GameState anyway.
You can use an Interface Messenger function to send from your widget back to gamestate.
If you use Add Child, you need to get your Parent and call RemoveChild(self). In 4.5 there’s just going to be a call you can make RemoveFromParent on any widget. Both these calls are separate from Add/Remove From Viewport, which is akin to saying, spawn this widget in a new window.
Hey, thanks for the answer.
Using GetParent->RemoveChild(self) alone without RemoveFroMViewport worked.
I used both. I guess that’s what you told me in your last sentence (my english isnt well enough to understand your last sentence :X)
Anyway, thanks for the help!