选择画面上创建按钮,并且在按钮上通过ICON_CREATE()添加图标。
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
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. |
运行效果:
以上。
1 条评论