GUI ScreenIO for Windows

 ScreenIO.com


Optional code

Optional code statements are used to label and classify optional blocks of COBOL code in your template. 

General format

    %name:type:

where name is the label of this block of COBOL code, and type is used to specify its context; that is, whether it applies to a control, an event, or some other situation. 

Type may be used by the program generator as an implied conditional; see below. 

Remarks

Implied conditionals

Optional code types that are specific to certain entities carry an implied conditional that the entity must be present in the panel in order for the imperative statement to be executed, even if an imperative statement explicitly includes the entity.

For example, an optional code block that is specific to a listview control (SUPPORT-CODE:LISTVIEW) will only be included if a listview is defined on the panel.

Type Description
BUTTON-SWITCH: Defines code to manage a pushbutton that may be enabled or disabled by your program.

Note:  This code will need to be modified in the generated program to implement the behavior you require in your application.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once for each pushbutton that may be enabled/disabled by your program.


%name:BUTTON-SWITCH:


Example:

%BUTTON-SWITCH-CODE:BUTTON-SWITCH:

      *    Enable or disable the pushbutton

FIX-->*--> IF some-condition
FIX-->*-->   SET @@EVENT-SWITCH-NAME@@-ENABLED TO TRUE
FIX-->*--> ELSE
FIX-->*-->   SET @@EVENT-SWITCH-NAME@@-DISABLED TO TRUE
FIX-->*--> END-IF

      *    Set the focus to the button

FIX-->*--> IF some-other-condition
FIX-->*-->   SET @@EVENT-SWITCH-NAME@@-FOCUSED TO TRUE
FIX-->*--> END-IF

EVENT-CODE: Defines code to manage an event.

Note:  This must be coordinated with the structure of your PANEL-LOOP: code; if you use EVALUATE in your panel loop, then this would insert a WHEN clause; if you used IF statements, you'd insert an IF/ELSE/END-IF.  You will find it easier to use EVALUATE.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once for each menu or pushbutton event that may be returned by the panel.  Usually included in the PANEL-LOOP.


%name:EVENT-CODE:


Example:

%HANDLE-EVENT:EVENT-CODE:

      *                : Menu event: @@EVENT-TEXT@@

             WHEN @@EVENT-NAME@@
               CONTINUE

FIELD-NAME:field-name Defines code to manage controls (data fields).

Note: FIELD-NAME code is not included if a SUPPORT-CODE block is available for the field.

If subject of !!INCLUDE: the generator will:

If field-name is absent,
    Include this code once for every field,
else
    If field-name is specified,
        If a control named field-name exists,
            Include this code for that control only.


%name:FIELD-NAME:field-name


Example:

%FIELDLOADER:FIELD-NAME:

FIX-->*--> MOVE ????? TO @@FIELD-NAME@@.

HOT-EVENT: Defines code to manage a hot field event.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once for each hot field event that may be returned by the panel.  Usually included in the PANEL-LOOP.


%name:HOT-EVENT:


Example:

%HANDLE-HOT-EVENT:HOT-EVENT:

      *      : Hot from @@FIELD-NAME@@

             WHEN @@HOT-EVENT-NAME@@
               CONTINUE

IMAGE-EVENT: Defines code to manage an image field event.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once for each image field event that may be returned by the panel.  Usually included in the PANEL-LOOP.


%name:IMAGE-EVENT:


Example:

%HANDLE-IMAGE-EVENT:IMAGE-EVENT:

      *      : Image event @@FIELD-NAME@@

             WHEN @@IMAGE-EVENT-NAME@@
               CONTINUE

MENU-SWITCH: Defines code to manage a menu item that may be enabled, disabled, checked, or unchecked by your program.

Note:  This code will need to be modified in the generated program to implement the behavior you require in your application.

If subject of !!INCLUDE: the generator will:

Insert the snippit that follows this statement once for each menu item that may be enabled/disabled or checked/unchecked by your program.


%name:MENU-SWITCH:


Example:

%MENU-SWITCH-CODE:MENU-SWITCH:

      *    Enable or disable the menu item

FIX-->*--> IF some-condition
FIX-->*-->   SET @@EVENT-SWITCH-NAME@@-DISABLED TO TRUE
FIX-->*--> ELSE
FIX-->*-->   SET @@EVENT-SWITCH-NAME@@-ENABLED TO TRUE
FIX-->*--> END-IF

      *    Check or uncheck the menu item

FIX-->*--> IF @@EVENT-NAME@@
FIX-->*-->   SET @@PANEL@@-DO-UPDATE-MENU-ITEMS TO TRUE
FIX-->*-->   IF @@EVENT-SWITCH-NAME@@-CHKED
FIX-->*-->     SET @@EVENT-SWITCH-NAME@@-UNCHK TO TRUE
FIX-->*-->   ELSE
FIX-->*-->     SET @@EVENT-SWITCH-NAME@@-CHKED TO TRUE
FIX-->*-->   END-IF
FIX-->*--> END-IF

MISC-CODE: Defines general-purpose code.  It is useful for defining second-level drivers for use by other entities.

If subject of !!INCLUDE: the generator will:

Insert the code that follows this statement when it is explicitly included using an imperative statement.


%name:MISC-CODE:

PANEL-COPYS: Causes the code generator to insert all of your panel copybooks at this location. 

You may modify this to include the subdirectory where your copybooks are located, although it is better practice to specify this as a compiler option rather than to hard-code it in your program.


%name:PANEL-COPYS:

PANEL-LOOP: Defines code to manage a panel.  The standard logic for handling a GUI ScreenIO panel consists of a loop that calls GUI ScreenIO to display the panel.

If subject of !!INCLUDE: the generator will:

Include this code where it is requested.


%name:PANEL-LOOP:


Example:

%DRIVER-PARAGRAPH:PANEL-LOOP:

       @@PANEL@@-DRIVER.

           PERFORM WITH TEST AFTER
               UNTIL @@PANEL@@-EVENT-CLOSE-WINDOW
                 OR  @@PANEL@@-EVENT-CLOSE-AND-STOP

             CALL 'GS' USING @@PANEL@@-1
                             @@PANEL@@-2
                             @@PANEL@@-3
                             @@PANEL@@-4

             EVALUATE TRUE
!!INCLUDE:HANDLE-EVENT
             END-EVALUATE

           END-PERFORM.

SELECTOR-EVENT: Defines code to manage a selector field event.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once for each selector field event that may be returned by the panel.  Usually included in the PANEL-LOOP.


%name:SELECTOR-EVENT:


Example:

%HANDLE-SELECTOR-EVENT:SELECTOR-EVENT:

      *      : SELECTOR from @@FIELD-NAME@@

             WHEN @@SELECTOR-EVENT-NAME@@
               CONTINUE

SEL-CHANGE: Defines code to manage a selection-change field event.

If subject of !!INCLUDE: the generator will:

Insert the code that follows this statement once for each selection-change event that may be returned by the panel.  Usually included in the PANEL-LOOP.


%name:SEL-CHANGE:


Example:

%HANDLE-SELECTION-CHANGE:SEL-CHANGE:

      *      : Selection change @@FIELD-NAME@@

             WHEN @@SEL-CHANGE-EVENT-NAME@@
               CONTINUE

SUPPORT-CODE:controltype Defines code to manage specific types of controls; presently, COMBOBOX, LISTBOX, LISTVIEW, and TREEVIEW controls.

Note:  This code generally appears as a performed routine in the program; it is usually necessary to coordinate the names of paragraphs generated by this type of entity with the code that invokes it.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement once when it is explicitly included, generally according to a conditional statement which tests for a specific type of control (see the conditional statement CONTROLTYPE). 


%name:SUPPORT-CODE:controltype

USER-CODE: Defines standard user code.

If subject of !!INCLUDE: the generator will:

Include the code that follows this statement in the generated program. 


%name:USER-CODE:


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom