This discussion is archived
2 Replies Latest reply: Apr 28, 2012 2:53 PM by 921640 RSS

setOnCloseRequest() from within controller?

921640 Newbie
Currently Being Moderated
Is it possible to set OnCloseRequest event handler for a Stage from within it's Scene's controller?

I'm not sure I'm being clear enough, so here is the scenario:

User opens an item for editing from the list of items. Item editor is in a new window. The user makes some changes, does not save them and tries to close the editor. In that instance I want the program to ask her whether she wants to save the changes, close without saving or cancel closing.

Of course, I want to setOnCloseRequest(EventListener<WindowEvent>) for the editor. :) Any thoughts or suggestions? It doesn't have to be my way, I just care about the functionality.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points