Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
subroutine ECLOSE_METHOD a_noclr ,n a_cancel ,n a_type ,n
Returned with any no_clear flag passed to U_FINISH. (n)
(optional) The cancel shutdown flag which is passed to U_FINISH. (n)
The flag defining the type of shutdown in progress: (n)
0 = U_FINISH was called directly.
1 = The user is closing the application.
2 = An interrupt (^C) was received.
ECLOSE_METHOD is a subroutine that you write and name. The name of your subroutine is registered with UI Toolkit using the E_METHOD subroutine.
UI Toolkit calls your ECLOSE_METHOD subroutine to allow customized shutdown processing for your application.
On Windows, ECLOSE_METHOD is called when U_FINISH is called and when the user closes the application using the System menu, close box, or Close menu entry. (This is applicable only if you have previously called U_START and interrupt is enabled.)
On UNIX and OpenVMS, ECLOSE_METHOD is invoked only when U_FINISH is called (so a_type is always 0 on these platforms).
If a_cancel is passed, this method can set it to true to cancel application shutdown if you passed the cancel argument to U_FINISH.
The following method would have to be registered in the transaction routine’s environment.
subroutine trx_close ; ; Description: Close method for transaction entry ; ; Arguments: ; a_noclr ,n ;"No clear" option for U_FINISH a_cancel ,n ;(Optional) cancel shutdown flag a_type ,n ;Type of shutdown: ; 1 = Close ; 2 = Interrupt .include "trxgbls.def" ;Global fields (g_changes, etc.) ; .align record style ,i4 ;Message box style proc if (g_changes) ;Are there unsaved changes ; to the transactions? begin if (^passed(a_cancel)) then ;Can we cancel ; shutdown? style = D_MYESNOCANCEL ;Yes, include ; cancel button else style = D_MYESNO ;No, only allow ; yes/no style = style + D_MICONEXCLAM ;Put an exclamation ; icon on using %u_msgbox("Save changes to transactions?", style) select (D_MIDYES), call save ;Save the transactions (D_MIDNO), nop ;No action required (D_MIDCANCEL),a_cancel = TRUE ;Cancel shutdown endusing end xreturn save, ;Insert code here to save all changes to ; transaction file return endsubroutine
The following code shows how you would use E_METHOD to register this method:
proc xcall e_enter xcall e_method(D_METH_APPCLOSE, "trx_close") . . . xcall e_exit xreturn .end