This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Save question before closing screen

General questions regarding the development with ProjX.

Save question before closing screen

Postby jvxdev » Thu Aug 25, 2016 1:03 pm

Is it possible to show a "Save changes" question before closing a screen?

If we use writeback isolation level DATAROW, it's a relevant question and also for simple Form screens, which only contains editors.
Last edited by jvxdev on Thu Aug 25, 2016 1:13 pm, edited 1 time in total.
Posts: 19
Joined: Fri Mar 04, 2016 12:40 pm

Re: Save question before closing screen

Postby Support@SIB » Thu Aug 25, 2016 1:12 pm

If you extend DataSourceWorkScreen, it should be possible to use:

Code: Select all
//setAskBeforeCloseMessage("Save changes?");

Override the method

Code: Select all
protected boolean hasChanges()

if you need specific control about change detection.

If you don't extend the DataSourceWorkScreen, it's also possible but needs more work:

Overwrite the method

Code: Select all

and check if your screen has changes. If it has changes, show a message and throw a SilentAbortException. The SilentAbortException won't open the error dialog but will cancel the current operation.

An example:

Code: Select all
if (isChanged())
    getApplication().showQuestion(this, "Save changes?",
                                  "doSaveChanges", "doRevertChanges");
    throw new SilentAbortException("Save question");
User avatar
Posts: 207
Joined: Mon Sep 28, 2009 1:56 pm

Return to Development