QUITCALL for MAIN Forms
- Last UpdatedOct 25, 2022
- 1 minute read
For forms of type MAIN, the QUITCALL callback is executed, if present. This permits you to terminate the application, and so the associated PML callback should prompt you for confirmation.
If you confirm the quit, then the callback should close down the application, and not return. If you decide not to quit, then the callback should return an error to indicate the decision to F&M.
Use return error... noalert if you want to avoid displaying an error alert. If the form has no QUIT callback, then the QUIT event will be ignored.
The following example shows a (Global) PML function, that could be use from all forms of type MAIN:
define function !!quitMain( )
-- Sharable method Quit the application
!str = !!Alert.Confirm('Are you sure you want to quit the application?')
if( !str eq 'YES' ) then
-- execute application termination command, which should not return
finish
else
return error 3 |user chose not to QUIT| noalert
endif
endfunction
This would be called from the form definition function body or from its constructor method as shown below:
Layout form !!myApplication MAIN
. . .
quitCall '!!quitMain( )'
. . .
exit
define method .myApplication( )
-- Constructor
!this.quitCall = '!!quitMain( )'
. . .
endmethod