cancel
Showing results for 
Search instead for 
Did you mean: 

Force the display of a Context Menu

aaron_morden2
Contributor
0 Kudos

I have created a Context Menu in my application that works fine when the user right clicks. However, I was wondering if there was anyway to force the context menu to appear without right clicking?

Below is some of the code I have been playing around with, but it is not working.

METHOD wddomodifyview.
  DATA menu             TYPE REF TO cl_wd_menu.
  DATA menu_manager     TYPE REF TO if_wd_context_menu_manager.
  DATA client_app       TYPE REF TO cl_wdr_client_application.
  DATA client_component TYPE REF TO cl_wdr_client_component.
  DATA comp_controller  TYPE REF TO if_wd_component.
  DATA controller_id    TYPE string.

  IF wd_this->show_context_menu = abap_true.
    CLEAR wd_this->show_context_menu.

    comp_controller  = wd_comp_controller->wd_get_api( ).
    controller_id    = comp_controller->get_id( ).
    client_component = cl_wdr_client_application=>get_instance( component_id = controller_id ).
    client_app       = client_component->root.

    menu_manager = view->if_wd_view_controller~get_context_menu_manager( ).
    menu = menu_manager->get_context_menu( 'MENU' ).

    menu->register_to_view( i_view = view ).

    client_app->set_context_menu(
        context_menu = menu
        is_dynamic   = abap_false ).

  ENDIF.

ENDMETHOD.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

i think it is not designed that way to work. it needs client event to trigger the context menu rendering. I am also not sure if it will a good design to have context menu appear always next to the UI.