ataylor Posted April 1, 2015 Share Posted April 1, 2015 I am building a document editor in UnigineScript. In world shutdown, the user is prompted "Do you want to save changes? yes/no". If the user chooses "yes" and the document has a known filename, it saves to that file, but if the document has not previously been saved, a filename must first be chosen. Unfortunately, it appears that calling 'wait' during shutdown process does not actually wait for the dialog to finish. See attached script: // this is called by world shutdown() function int OnSave(){ Unigine::Widgets::DialogFile dialog=new Unigine::Widgets::DialogFile("Save"); dialog.arrange(); Unigine::Widgets::addChild(dialog); dialog.setPermanentFocus(); log.message("TEST 1\n"); while(dialog.isDone() == 0) wait; log.message("TEST 2\n"); } This function works as expected during normal usage, but does not finish during world shutdown. "TEST 1" is logged but "TEST 2" does not log -- the app closes first. How can I spawn a DialogFile during world shutdown? Link to comment
unclebob Posted April 3, 2015 Share Posted April 3, 2015 Hi Adam! The only way you have is to use built-in engine.app.dialogMessage function (https://developer.unigine.com/en/docs/1.0/scripting/library/engine/engine.app#engine.app.dialogMessage_string_string_string). Notice that you can't cancel shutdown process at all, you could only ask if user wants to save changes. Link to comment
Recommended Posts