Events of the SAP Toolbar Control
Use
Events are triggered by selecting the pushbuttons of the SAP Toolbar Control depending on the pushbutton type:
|
Incident |
Event ID cl_gui_toolbar=> |
Description |
|---|---|---|
|
FUNCTION_SELECTED |
M_ID_FUNCTION_SELECTED |
Pushbutton chosen A menu for a pushbutton of type type cntb_btype_dropdown or cntb_btype_menu was selected. |
|
DROPDOWN_CLICKED |
M_ID_DROPDOWN_CLICKED |
Context menu of a pushbutton (type cntb_btype_dropdown and cntb_btype_menu) chosen |
You get the following event parameters for this event:
|
Incident |
Parameter |
Description |
|---|---|---|
|
FUNCTION_SELECTED |
fcode |
Function code of the button |
|
DROPDOWN_CLICKED |
fcode |
Function code of the button |
|
posx posy |
Position of the pushbutton whose menu is displayed |
Integration
To react to an event in your ABAP program, you must have registered it. To relink containers, use the set_registered_events method. Events that are triggered but for which you are not registered are filtered on the front end, and not passed to the back end. See Event Handling.
Features
Event FUNCTION_SELECTED
This event is always triggered when a pushbutton has been pressed or a menu entry of a pushbutton of type cntb_btype_dropdown or cntb_btype_menu has been selected.
Pushbuttons of type cntb_btype_dropdown consist of two parts. On the left-hand side is the actual pushbutton, with a particular function assigned to it, just like a normal pushbutton. If this button is pressed, the event FUNCTION_SELECTED is triggered. An arrow can be seen on the right-hand side of a pushbutton. If this is selected, the event DROPDOWN_CLICKED is triggered.
If the pushbutton has the type cntb_btype_menu, the event DROPDOWN_CLICKED is always triggered.
You get the function code of the button as the event parameter of the event FUNCTION_SELECTED. This allows you to identify the pushbutton and react accordingly in your program.
Event DROPDOWN_CLICKED
The event is always triggered when a menu can be displayed for a pushbutton. This is only possible for pushbuttons of type cntb_btype_dropdown or cntb_btype_menu.
As event parameter you get the function code and position of the pushbutton. You can identify the button using the function code. You can use the position to place the content menu in the right location.
To construct the context menu, use the methods of class CL_CTMENU. To display it, use the track_context_menu method.