Modifications to Form-Clear Logic (Functions/Subroutines/Programs)
Created at 05 MAY 1996 03:27PM
In OpenInsight through version 3.1, the CLEAR event was only executed if it was specifically sent or posted. If the Clear Form after Write option (accessed from the Database - Options menu in the Form Designer) is set, the form is cleared, but not by using a CLEAR event, (this is documented in the Programmer s Reference under the CLEAR event). The result was that processing had to be added by the programmer in order to handle the CLEAR that resulted from the WRITE event. Starting with the 3.11 maintenance release, the CLEAR event is now sent to the window in the following scenarios:
1. On READ, if the row is locked and the user chooses not to view it
2. On READ, if the read fails for any other reason
3. On WRITE, if the Clear Form after Write option is set
4. On WRITE, if the row exists and is locked and the user chooses not to overwrite the row
5. On successful DELETE processing
This change will only affect applications that have processing on the CLEAR event. If the processing on the CLEAR event was designed to only be executed when the CLEAR event was sent (which typically would only be possible from the File - Clear Form F8 option in the default OpenInsight Tables menu) and not for the five cases listed above, then the CLEAR event processing may require modification. Additionally, if the application has processing in the WRITE event to handle the CLEAR processing, it is suggested that the processing be moved to the CLEAR event.
The CLEAR event has several powerful options, including the ability to save the current key, suppress the Changes were made warnings, and specify the control to have focus after the CLEAR event is processed. The event definition is as follows:
Function CLEAR(CtrlEntID, CtrlClassID, bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
If processing is implemented on the CLEAR event, either return 1 or use Forward_Event() to allow the system CLEAR processing to occur. The following two examples show how this event code could be structured:
Function CLEAR(CtrlEntID, CtrlClassID, bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
* user code to process the CLEAR event would be placed here
Return 1
Function CLEAR(CtrlEntID, CtrlClassID, bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
declare subroutine Forward_Event
* place user code here that must be processed before the system CLEAR processing
Forward_Event(bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
* place user code here that must be processed after the system CLEAR processing
Return 0
To over-ride the default options passed to the CLEAR event, it is easiest to use the Forward_Event method with modified values:
$insert Logical
bSuppressWarning = TRUE$
Forward_Event(bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
________
See Also: CLEAR event, WRITE event, Forward_Event()