• 在选择画面中创建按钮(push button)


    选择画面上创建按钮,并且在按钮上通过ICON_CREATE()添加图标。

    代码:

    REPORT ZTEST_PUSHBUTTON.
    TYPE-POOLS: icon.
    TABLES sscrfields.
    *--------------------------------------------------------------*
    *Selection-Screen
    *--------------------------------------------------------------*
    SELECTION-SCREEN:
          PUSHBUTTON /2(40) button1 USER-COMMAND but1, "40是按钮长度
          PUSHBUTTON /2(40) button2 USER-COMMAND but2.
    *--------------------------------------------------------------*
    *At Selection-Screen
    *--------------------------------------------------------------*
    AT SELECTION-SCREEN.
    * 相应按钮事件
      CASE sscrfields.
        WHEN 'BUT1'.
          MESSAGE 'Button 1 was clicked' TYPE 'I'.
        WHEN 'BUT2'.
          MESSAGE 'Button 2 was clicked' TYPE 'I'.
      ENDCASE.
    *--------------------------------------------------------------*
    *Initialization
    *--------------------------------------------------------------*
    INITIALIZATION.
      button1 = 'Button 1'.
      button2 = 'Button 2'.
    * 按钮上添加图标
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name   = icon_okay
          text   = 'Continue'
          info   = 'Click to Continue'
        IMPORTING
          RESULT = button1
        EXCEPTIONS
          OTHERS = 0.
    
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name   = icon_cancel
          text   = 'Exit'
          info   = 'Click to Exit'
        IMPORTING
          RESULT = button2
        EXCEPTIONS
          OTHERS = 0.

    运行效果:

    2017-02-16_9-39-36

    以上。

  • 相关阅读:
    「CF1051F」The Shortest Statement
    「CF911F」Tree Destruction
    「HNOI/AHOI2018」游戏
    「CF859E」Desk Disorder
    「CF858F」 Wizard's Tour
    「CF894E」 Ralph and Mushrooms
    「NOIP2018」赛道修建
    「POI2010」Bridges
    常见神经网络
    数字图像处理笔记2.22
  • 原文地址:https://www.cnblogs.com/datie/p/11435843.html
Copyright © 2020-2023  润新知