Table of Contents

Uncommon Knowledge - WC_Reset%

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 JAN 19912.021+EXPERTWINDOW_COMMON%, WC_RESET%, WC_IS_ORIG%, WC_IS%, WC_WDONE%, WINDOW_COMMON_SHORT%, WINDOW.CONSTANTS

WC_Reset% is a flag variable used to tell the window interpreter that the developer has made changes to other common variables and that these changes ought to be evaluated and processed. It may take a value of 1 to 6, these being defined in the WINDOW.CONSTANTS record in the INCLUDE file as follows

       EQU CLEAN.UP.LINE$           TO 1
       EQU CLEAN.UP.EDIT$           TO 2
       EQU RESET.EDIT$          TO 3
       EQU RESET.PROMPT$        TO 4
       EQU RESET.RECORD$        TO 5
       EQU RESET.WINDOW$        TO 6

These values are actually quite self- explanatory once you know what they do! WC_Reset% is only looked at at certain predefined points when the window is running, and some processes ignore it entirely. Actions caused by WC_Reset% can be misleading. To illustrate, WC_Reset% might be set to 6 on a default process and the window might close. It might therefore be assumed that the default process was responsible for the closing of the window. This is only partially true. Heavy use of commuter logic reveals that the default logic ignores the setting of WC_Reset% and that it is the subsequent Pre Prompt logic that picks up the request to close the window.

In the following discussion consideration will be given to how various values of WC_Reset% alter the window logic flow. Other variables affected by WC_Reset% will be considered by example as they are encountered. When the text states that "the perpetual process is run" (or some other process) it is implicit that this only happens if a perpetual process (or the appropriate process) has been defined. In all cases a WC_Reset% value of 6 closes the window so this will not be repeated to save space.

Pre Application

Catalyst Calls and Commands may be executed before a window is invoked by adding the construct(s) PREAPP=@Code Command@ to the command line. If WC_Reset% is set here, it will be ignored until additional window processing has occurred. Thus if WC_Reset% were set to 6 here, the window would still display and execute various processes before actually closing. If a PREAPP wishes to close the window, it should set WC_WDone% to 1 and the window will close immediately. Note that accessing WINDOW_COMMON at this stage of the window interpreter requires careful manipulation of the COMMON block. At this stage, although WC_Reset% and WC_WDone% can be accessed, the various dimensioned common variables cannot. Therefore a special common block must be constructed (called for example WINDOW_COMMON_SHORT%) which contains all of the common variables up to (but not including) the first dimensioned common variable (WC_W%( WC_W_CNT%)). This can then be $INSERTed and the variables may then be referenced without fatal error messages regarding unassigned common variables.

Pre-Init

As with Pre-App, Pre-Init ignores the WC_Reset% variable. If it is required that the window be exited, use the WC_WDone% variable and WINDOW_COMMON_SHORT%.

Post-Init

As with Pre-App, Post-Init ignores the WC_Reset% variable. If it is required that the window be exited, use the WC_WDone% variable and WINDOW_COMMON_SHORT%.

Pre-Proc

The Pre Prompt Process looks at WC_Reset% values of 4, 5 and 6.

WC_Reset% ValueBehaviour
4The Perpetual Process will be run. If there is no value in WC_Is%, the Default Process will be run, then control will return to the Pre Prompt Process. In the special case where the cursor has not yet been through the first field after the key on the data entry window, the Perpetual Process will be run, followed by the Pre Read Process, the Rep Read Process and then the Post Read Process. Finally if there is no value in WC_Is%, the Default Process will be run, then control will return to the Pre Prompt Process.
5The sequences initiated by WC_Reset% = 4 are followed with the omission of the Perpetual Process.

Dflt Proc

Ignores WC_Reset%.

Edit Proc

The Edit process looks at all WC_Reset% values except in the case of multivalued fields (both associated and non-associated) where WC_Reset% is ignored. (NB please remember the caveat that in this article we are only considering effect on window flow).

WC_Reset% ValueBehaviour
1Returns to prompt with WC_Is% set to the entered value and WC_Is_Orig% unchanged.
2
3
The Post Process will be run, followed by the Perpetual Process and then the Pre Prompt Process. It will then return to the prompt with both WC_Is% and WC_Is_Orig% set to the new value.
4The Perpetual Process will be run, followed by the Pre Prompt Process. It will then return to the prompt with WC_Is% and WC_Is_Orig% unchanged.
5The Pre Prompt Process will be run. It will then return to the prompt with WC_Is% and WC_Is_Orig% unchanged.

Post-Proc

The Post Prompt Process looks at WC_Reset% values of 4, 5 and 6.

WC_Reset% ValueBehaviour
4Key Prompt. If this is the first entry into a prompt, or the previous screen was refreshed or saved then the Perpetual Process will be run. If there is no value in WC_IS%, the Default Process will be run. Finally, the Pre Prompt Process will be run and it will then return to the prompt.

If the previous record was deleted, the Perpetual Process will be run, WC_Is% will be set to "" (i.e. a blank @ID) and processing will continue at the next prompt.

If the previous key has been changed, the Perpetual Process will be run, WC_Is% will be set to WC_Is_Orig% and processing will continue at the next prompt.
5Key Prompt. This setting of WC_Reset% behaves as 4 with the exception that the Perpetual Process is skipped.
4Non Key Prompt. WC_Is% is set to WC_Is_Orig% the Perpetual Process is run then processing continues at the next prompt.
5Non Key Prompt. This setting of WC_Reset% behaves as 4 with the exception that the Perpetual Process is skipped.

Invalid Proc

Ignores WC_Reset%

Perp Proc

The Perpetual Process only looks at a WC_Reset% value of 6, which closes the window.

Pre Read

The Pre Read Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to key prompt without running Replace or Post Read.

Rep Read

The Replace Read Process only looks at a WC_Reset% value of 6, which closes the window.

Post Read

The Post Read Process only looks at a WC_Reset% value of 6, which closes the window.

Pre Save

The Pre Save Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to key prompt without running Replace or Post Save (hence not saving any changes). However WC_Prec% is set to the version of @RECORD that has been abandoned which is not valid.

Rep Save

The Rep Save Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to key prompt without running Post Save.

Post Save

The Post Save Process only looks at a WC_Reset% value of 6, which closes the window.

Pre Delete

The Pre Delete Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to key prompt without running Replace or Post Delete (hence not deleting the record).

Rep Delete

The Rep Delete Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to key prompt without running Post Delete.

Post Delete

The Post Delete Process only looks at a WC_Reset% value of 6, which closes the window.

Post App

Ignores all values of WC_Reset%.

Collector Read Proc

As with Pre-App, Post-Init ignores the WC_Reset% variable. If it is required that the window be exited, use the WC_WDone% variable and WINDOW_COMMON_SHORT%.

Collector Save Proc

The Collector Save Process Process looks at WC_Reset% values of 5 and 6.

WC_Reset% ValueBehaviour
5Returns to window with @RECORD nulled down.

(Volume 2, Issue 8, Pages 8-11)