cancel
Showing results for 
Search instead for 
Did you mean: 

Context menu on dynamically added image - what was right-clicked on?

matt
Active Contributor
0 Kudos

I've a context menu (IMAGE_MENU) with two menu actions. I'm dynamically adding images to my view:

data(image) = cl_wd_image=>new_image(

    id = 'UNIQUE_ID'

    source = '~Icon/Cancel'

    context_menu_id = 'IMAGE_MENU'

    context_menu_behaviour = cl_wd_image=>e_context_menu_behaviour-provide ).


data(flow_data) = cl_wd_flow_data=>new_flow_data( element = image ).

i_container->add_child( image ).


All works fine. When I right click on the image, I see my context menu. The problem is that when I chose a menu option, the action triggers, but WDEVENT doesn't tell me the context element.


WDEVENT->PARAMETERS has the value of the selected menu option, but CONTEXT_ELEMENT points to null.

WDEVENT->SOURCE_COMPONENT_ID (which is what I expected to have the value of my image_info-name) is blank.


Any ideas?


Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Matthew,

The parameter 'CONTEXT_ELEMENT' of a menu action will be filled when we use the menu inside a table/ on table cell.

To get the details of view element on which the menu is called, use the parameter CONTEXT_MENU_EVENT of  method 'WDDOONCONTEXTMENU'.

The method 'WDDOONCONTEXTMENU' is called as soon as we right click for menu.

Hope this helps you.

Regards,

Rama

matt
Active Contributor
0 Kudos

That's it. I tried every thing connected with context menus... except for that. CONTEXT_MENU_EVENT->NAME contains my right-clicked object ID.

Answers (0)