When PF-STATUS
is full of the buttons and you cannot write another SELECTION-SCREEN - FUNCTION KEY
since all keys are specified in LDB, you can add your own button just like GOS does.
Examples
SE38 -> ZEUI_TEST_MENU
...
METHODS:
" Event of CL_GUI_TOOLBAR
on_gos_menu_clicked FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING
fcode.
...
" GOS like button
DATA(lo_menu) = NEW zcl_eui_menu(
io_handler = me ). " <- handler is ON_GOS_MENU_CLICKED
" Create one button
lo_menu->create_toolbar(
iv_width = 90
it_menu = VALUE #(
( function = mc_cmd-email
text = `E-mail`
icon = icon_mail ) ) ).
...
METHOD on_gos_menu_clicked.
" Only one code
CHECK fcdoe = mc_cmd-email.
...
" Nested menu
lo_menu->create_toolbar(
it_menu = VALUE #(
( function = '_OAOR_ROOT' ... )
( par_function = '_OAOR_ROOT' " After parent element
function = '_OAOR_IMPORT'
...
ZCL_EUI_MENU info
Class ZCL_EUI_MENU creates a menu based on CL_GUI_TOOLBAR and uses CL_GUI_GOS_CONTAINER if no other container has been passed to to him.
Menus can be created (or recreated) by calling CREATE_TOOLBAR method.
It takes 2 parameters:
- IV_WIDTH – optional parameter. If the toolbar has texts, not just icons
- IT_MENU – hierarchical menu with a description of the buttons
Main parameters for CL_GUI_TOOLBAR passed with STB_BUTTON (function id, icon, text).
Separator created by specifying butn_type = cntb_btype_sep
To create a hierarchy you have to fill PAR_FUNCTION parameter
The event handler itself is specified in the constructor (IO_HANDLER parameter) or in the CHANGE_HANDLER method
This parameter represents the object in which the public method should be declared like this
ON_FUNCTION_SELECTED
for event FUNCTION_SELECTED of CL_GUI_TOOLBAR
The name of the method does not matter since the method is searched by its signature
To change the menu in RunTime (for example, hide the menu after starting the program) you can access the container or CL_GUI_TOOLBAR itself