Save question before closing screen
2 posts
• Page 1 of 1
Save question before closing screen
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.
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.
- jvxdev
- Posts: 19
- Joined: Fri Mar 04, 2016 12:40 pm
Re: Save question before closing screen
If you extend DataSourceWorkScreen, it should be possible to use:
Override the method
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
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
setAskBeforeClose(true);
//optional
//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
notifyDestroy()
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");
}
-
Support@SIB - Posts: 355
- Joined: Mon Sep 28, 2009 1:56 pm
2 posts
• Page 1 of 1