In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

Uncommon Knowledge - WC_Reset%

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


0001           EQU CLEAN.UP.LINE$           TO 1
0002           EQU CLEAN.UP.EDIT$           TO 2
0003           EQU RESET.EDIT$          TO 3
0004           EQU RESET.PROMPT$        TO 4
0005           EQU RESET.RECORD$        TO 5
0006           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% = 4  The 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.

    WC_Reset% = 5  The 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% = 1  Returns to prompt with WC_Is% set to the entered value
                   and WC_Is_Orig% unchanged.

    WC_Reset% = 2  The Post Process will be run, followed by the Perpetual
  & WC_Reset% = 3  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.

    WC_Reset% = 4  The 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.

    WC_Reset% = 5  The 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% = 4  Key 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.

    WC_Reset% = 5  Key Prompt. This setting of WC_Reset% behaves as 4 with
                   the exception that the Perpetual Process is skipped.

    WC_Reset% = 4  Non Key Prompt. WC_Is% is set to WC_Is_Orig% the
                   Perpetual Process is run then processing continues at the
                   next prompt.

    WC_Reset% = 5  Non 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% = 5  Returns 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% = 5  Returns 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% = 5  Returns 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% = 5  Returns 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% = 5  Returns 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% = 5  Returns to window with @RECORD nulled down.
(Volume 2, Issue 8, Pages 8-11)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel