Push Buttons

LANSA for i

Push Buttons

A push button is an area on the screen labeled with text, which represents an action that will be initiated when a user selects it.

  • It must be an alphanumeric field with a maximum length of 60.
  • The text stored in the variable will be centered and displayed as the push button text.
  • It must be no identification (*NOID).
  • Push buttons are defined through the PBnn input/output attribute, where nn is the push button number from 01 to 20.
  • Each push button may only be used once per screen command (i.e., DISPLAY/ REQUEST/ POP_UP). A particular push button attribute (i.e., PB08) may be used against more than one field in a function as long as those fields do not appear in the same screen command.
  • Due to the graphical representation on PC displays, push buttons must be separated from other information immediately above and below it by a blank line.
  • To determine if a push button has been pressed, test the IO$KEY field for a push button value. Push button 1 to 9 returns "B1" to "B9" and push button 10 to 20 returns "BA" to "BK".

        BEGIN_LOOP

          REQUEST    FIELDS(#SCREEN)

          IF         COND('#IO$KEY *EQ ''BC'')

            MESSAGE    MSGTXT('Button 12 was Pressed')

          ENDIF

        END_LOOP

 

and also through the WAS() option of the IF_KEY command:

        BEGIN_LOOP

          REQUEST    FIELDS(#SCREEN)

          IF_KEY     WAS(*BUTTON1)

            MESSAGE    MSGTXT('Button 1 was Pressed')

          ENDIF

        END_LOOP