Terminate the UI Toolkit environment

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall U_FINISH([D_NOCLR][, cancel])



(optional) Don’t clear the screen. By default, the screen is cleared when Toolkit processing is terminated. (n)


(optional) Returned true if the close method subroutine cancels the shutdown. (n)


U_FINISH shuts down the UI Toolkit environment. It purges all channels U_START or U_OPEN opened in output mode except the terminal (if it was opened by U_START). U_FINISH is called by your application. It is also called internally by Toolkit.

If you have used E_METHOD to register an ECLOSE_METHOD with the environment, U_FINISH calls that ECLOSE_METHOD to perform any additional processing before shutting down the application.

If you pass cancel, it is passed on to your ECLOSE_METHOD. If you want your ECLOSE_METHOD to cancel termination, have it set a_cancel to true, and it will get passed back to your application through cancel.

If you do not pass cancel, your ECLOSE_METHOD will not have the opportunity to cancel the shutdown. 

U_FINISH’s default is to clear the screen when Toolkit processing is terminated. If you pass D_NOCLR, the screen will not be cleared.

On Windows, if the application has previously called U_START and interrupt is enabled, the user can also close the application through the System‑menu box or with the interrupt key. In both cases, UI Toolkit will internally call U_FINISH.

See also

E_METHOD and ECLOSE_METHOD for more information about environment‑level events (such as shutting down the application).


The following example terminates Toolkit processing without clearing the screen.

xcall u_finish(D_NOCLR)