Entering content frameFunction documentationEvents for the SAP Toolbar Locate the document in its SAP Library structure

Use

When the user chooses a pushbutton in the SAP Toolbar, one of the following events is triggered, depending on the type of the pushbutton:

Event

Event ID

cl_gui_toolbar=>

Meaning

FUNCTION_SELECTED

M_ID_FUNCTION_SELECTED

Pushbutton chosen

User chose a menu with type cntb_btype_dropdown or cntb_btype_menu .

DROPDOWN_CLICKED

M_ID_DROPDOWN_CLICKED

Context menu of a pushbutton (type cntb_btype_dropdown and cntb_btype_menu ) chosen

The events have the following parameters:

Event

Parameters

Meaning

FUNCTION_SELECTED

fcode

Function code of pushbutton

DROPDOWN_CLICKED

fcode

Function code of pushbutton

posx

posy

Position of the pushbutton for which the menu should be displayed

Integration

To react to an event in your ABAP program, you must have registered it. To do this, use the method set_registered_events. Events that are triggered but for which you are not registered are filtered by the presentation server, and not passed to the application server. See Structure link event handling.

Features

Event FUNCTION_SELECTED

This event is always triggered when the user chooses a pushbutton or a menu entry from a pushbutton with type cntb_btype_dropdown or cntb_btype_menu .

Pushbuttons with type cntb_btype_dropdown have two parts: On the left-hand side is the actual pushbutton, with a particular function assigned to it, just like a normal pushbutton. If you click the button, the FUNCTION_SELECTED event is triggered. On the right-hand side is a pushbutton with an arrow. If you click this, the event DROPDOWN_CLICKED is triggered.

If the pushbutton has the type cntb_btype_menu, the event DROPDOWN_CLICKED is always triggered.

The function code of the pushbutton is passed as a parameter of the event FUNCTION_SELECTED . This allows you to identify the pushbutton and react accordingly in your program.

Event DROPDOWN_CLICKED

This event is triggered whenever a menu is requested for a pushbutton. This is only possible for pushbuttons with the type cntb_btype_dropdown and cntb_btype_menu .

The event parameters are the function code and position of the pushbutton. You can use the function code to identify the pushbutton. You can use the position to place the context menu in the correct position.

To construct the context menu, use the methods of class CL_CTMENU . To display it, use the method track_context_menu.

Note

It is more efficient to use a static context menu for pushbuttons with menus. For further information, refer to Using Static Dropdown Menus.

 

 

Leaving content frame