Terminate
Terminate(iResult)
Used to terminate the form
iResult | Integer | value to be returned from the form Open method |
---|
Applies to: Form
Int | Value returned to the Open() method |
---|
This method is used to terminate the current form under program control from within an event handler. The specified integer value is returned by the form Open() method. For example:
.form.Terminate(5)
Note: Currently the integer value returned by this method is limited to be an unsigned 16 bit integer between 0 and 65535. Numbers greater than this will be reduced modulo 65536. In a future version of KCML this may be relaxed.
Note: If Terminate is called more than once the value returned by Open() wil be from the final Terminate. The default OK and Cancel button handlers also set the return value. It is possible for a queued cancel button click to override the intended return value. The most likely scenario for this is when using the EventPending() method to look out for a cancel during long operations and calling Terminate immediately. To avoid this any special return value should be set in a cancel button handler.
Eg. Instead of:
IF (.form.EventPending()) .form.Terminate(CancelVal) END IF
Use:
IF (.form.EventPending()) RETURN FALSE END IF
and
- DEFEVENT MyForm.cancel.Click() .form.Terminate(CancelVal) END EVENT