GUI ScreenIO for Windows

 ScreenIO.com


How to Use Pushbutton Controls in Your Program

A pushbutton is not like the data-related controls; it's treated exactly like a menu item.

When the user presses a pushbutton (or its accelerator key), GUI ScreenIO will return to your program, and the reason for the return will be found in the event ID field. 

You test this by evaluating the 88 level items beneath the event ID field, same as for any other event.

The name of the 88 level item for your pushbutton and menu events is provided by you when you define them.  The editor just prefaces the panel name so that the events are unique if you have more than one panel in your program with the same event name.

Here's a portion of the panel copybook showing how the event ID field is defined, with the value for a pushbuttons named ENGLISH, FRENCH, and SPANISH. 

  01  panel-1.
        .
        .
*                  :---------------------------------------
*                  : Events returned in response to menu
*                  : or toolbar selections, buttons, etc.
*                  :---------------------------------------
        10 panel-EVENT-ID       PIC S9(4) COMP-5 VALUE 0.
          88 panel-ENGLISH      VALUE 3.
          88 panel-FRENCH       VALUE 4.
          88 panel-SPANISH      VALUE 5.

If you checked the box "May be disabled at runtime" when you defined your pushbutton, these additional fields will appear in your copybook.  The comments explain how to use these fields..

*                  :---------------------------------------
*                  : Menu Item Switches:
*                  : Move 'Y' to the following switches
*                  : to disable (and gray) or to set a
*                  : checkmark next to the menu item.
*                  : Any other value is ignored.
*                  :---------------------------------------
        10 panel-MENU-SWITCHES VALUE SPACE.
          15 panel-DIS-ENGLISH PIC X.
          15 panel-CHK-ENGLISH PIC X.

Here's the coding style we'd use to display a panel and test why it came back. 

        PERFORM WITH TEST AFTER
            UNTIL panel-EVENT-CLOSE-WINDOW 
            OR panel-EVENT-CLOSE-AND-STOP
   * ------------------------: Display the test panel.
            CALL 'GS' USING panel-1 
                            panel-2
                            panel-3
                            panel-4
          EVALUATE TRUE
   *                         : User pressed "English" button
          WHEN panel-ENGLISH
            SET panel-DO-CHANGE-LANGUAGE TO TRUE
            SET panel-LANGUAGE-DEFAULT TO TRUE

   *                         : User pressed "French" button
          WHEN panel-FRENCH
            SET panel-DO-CHANGE-LANGUAGE TO TRUE
            SET panel-LANGUAGE-FRENCH TO TRUE

   *                         : User pressed "Spanish" button
          WHEN panel-SPANISH
            SET panel-DO-CHANGE-LANGUAGE TO TRUE
            SET panel-LANGUAGE-SPANISH TO TRUE

        END-EVALUATE
      END-PERFORM.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom