So I’ve created a ‘main_menu’ widget with a button called ‘Quit’ and a ‘confirm_quit’ widget with a yes and no button.
Concerning the ‘main_menu’, when pressed on ‘Quit’, the following happens:
OnClicked → Set is enabled = false → Create Widget → Add to viewport.
So far so good, I can see the widget and when clicked on ‘Quit’ it calls the ‘confirm_quit’ widget.
Now, when pressed on the ‘no’ button, I want ‘main_menu’ to be enabled again…
How can I access the ‘main_menu’ widget from my ‘confirm_quit’ widget to set it enabled again?
The quickest one that pops to mind is to create an “Owner” variable inside of your “popup” of UserWidget type. That way when your widget constructs the popup, you assign the “Owner” to self. Inside your popup, when you choose no, call Owner->main_menu->set enabled.
Hey Justin, thanks for your answer. However I did not get it to work yet, I’m probably not doing what you’ve told me but I don’t know what I’m doing wrong. Here’s what I’ve got, this blueprint is the ‘yes’ and ‘no’ button. I’ve done what you said (i hope) on the ‘no’ button… http://oi60.tinypic.com/dq3sw5.jpg
In your Popup widget add an “Event Dispatcher” and give it an appropriate name (I called mine Toggle). Then drag the event dispatcher onto the Event Graph and choose Call, you will get a node that looks like my “call Toggle” and in your OnClicked (btn_ignore_quit) you will hook it up to it (removing what you curently have there)
Then in your menu widget, you would override the popup creation like this (you would be adding it to the viewport, I’m adding it to a horizontal box that I have set up for testing). Before you add it to viewport, you would assign the toggle event. That way, whenever you click cancel button, it will trigger that event.