How can I create a confirmation widget, that will communicate back to its parent?

I would like to create a separate widget with “confirm” and “decline”. Which will be created by any buttons pressed that would require such a confirmation, such as when a player presses “new game”.

I created the confirmation widget along with buttons, but I don’t know how to communicate the player’s choice back to the main menu widget.

You’re looking for an Event Dispatcher. A native button already has one (more than one, actually). For a menu that creates a pop-up prompt that reports back to its creator, you could hook it up like so:

Above, the OK | CANCEL are the buttons. You can add a more complex dispatcher to the prompt widget, one that sends actual data, too.

1 Like

Thanks a bunch man! Will try as soon as i get back to my project!

I’m running into this same problem, I tried to view the image you posted but it looks like it’s no longer valid. Do you still have a link to that screenshot?

I do not. Instead, I trusted the forums wizards with my precious screenshots and they lost it, an appropriate complaint has been filed, worry not!


While we wait for the stuff to get fixed:

  • this is my wOptions widget that has OK and CANCEL buttons:

  • and this is my wMain widget that shows the abovementioned wOptions

image

  • when the user presses OPTIONS a new options menu with OK and CANCEL buttons pops up
  • we register the button clicks of the new options menu with events in the wMain
  • if any of those buttons are clicked, wMain will fire the appropriate event, (replace Print Strings with what you need to happen) and the menu gets closed

The above can be made better / cleaner with a custom event dispatcher.

1 Like