The SAP Toolbar control
General
Add method
Add_button_group method
Set_button state method
Simple example
Advanced example
Add method
Add_button_group method
Set_button state method
Simple example
Advanced example
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

最低0.47元/天 解锁文章
223

被折叠的 条评论
为什么被折叠?



