ABAP--How to use Toolbar control(SAP样例摘抄)

 
The SAP Toolbar control
 
General
Add method

Add_button_group method
Set_button state method
Simple example

Advanced example
See also Set up event handling for controls for a general example of event handling
Note: To get a list of all icons, use program SHOWICON.
Adds a new button to the toolbar
   CALL METHOD go_toolbar->add_button
      EXPORTING fcode       = 'EXIT'                             "Function Code for button
                icon                       = icon_system_end         "ICON name, You can use type pool ICON
                is_disabled          = ' '                                     "Disabled = X
                butn_type             = gc_button_normal         "Type of button, see below
                text                        = 'Exit'                                "Text on button
                quickinfo              = 'Exit program'                 "Quick info
                is_checked          = ' '.                                     "Button selected
 
Toolbar button types used in method ADD_BUTTON :
Value
Constant
Meaning
0
cntb_btype_button
Button (normal)
1
cntb_btype_dropdown
Pushbutton with menu
2
cntb_btype_menu
Menu
3
cntb_btype_sep
Seperator
4
cntb_btype_group
Pushbutton group
5
cntb_btype_check
Checkbox
6
 
Menu entry
This method is used to add a list of buttons to the toolbar. The buttons are defined in a table of type TTB_BUTTON , and it can be filled witha button definitions using method fill_buttons_data_table of the cl_gui_toolbar class. The button group is added to the toolbar using method add_button_group of the toolbar object. 
* 1. Declare a table for buttons
DATA: gi_button_group            TYPE ttb_button.
* 2. Create buttons in button table
 CALL METHOD cl_gui_toolbar=>fill_buttons_data_table
 EXPORTING
    fcode            = 'Disable'
*    icon            =
*    DISABLED        =
     butn_type       = cntb_btype_group
*    TEXT            =
*    QUICKINFO       =
*    CHECKED         =
 changing
    data_table       = gi_button_group
* EXCEPTIONS
*    CNTB_BTYPE_ERROR = 1
*    others           = 2
.
CALL METHOD cl_gui_toolbar=>fill_buttons_data_table..... add more buttons to the table
*3. Add button group to toolbar
 CALL METHOD go_toolbar->add_button_group
    EXPORTING data_table = gi_button_group.
Used to change the state of individual buttons at runtime. If the button should be removed, use the delete_button method.
CALL METHOD go_toolbar->set_button_state
 EXPORTING
*    ENABLED          = 'X'
*     CHECKED         = ' '
     fcode                 =                      "Note: Th
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值