on 03-15-2010 12:02 PM
I have defined a context menu for my view, and a menu item in it with a certain action.
In the action handler method, I have 3 parameters:
- ID
- WDEVENT
- CONTEXT_NODE
For all the UI elements in my screen, I have deactivated the context menu. Only for one link, I have activated it.
Unfortunately, the 3 parameters above only tell me the ID of the context menu, not the ID of the link.
Is there a way to find out programatically, which UI element the user right-clicked on?
Hi,
to get which option user clicked on...(if i understood your question correctly) you can do following:
1) create an attribute at component level....of type IF_WD_VIEW...
1.1) go to component controller...select the attibute tab and create the attribute name could be anything...i just called it:
"Z_VIEW_REF" .....make sure you check the public and type ref to check boxes...
2) now go to your view where you menu item ui is...and select the methods tab....
2.1) select WDDOMODIFYVIEW...and put the following code in it....
if first_time = 'X'.
WD_COMP_CONTROLLER->Z_VIEW_REF = view.
endif.
3) on the action methd for the menu item write the following code:
data lo_menu_item type ref to cl_wd_menu_item.
data lo_maction type ref to CL_WD_MENU_ACTION_ITEM.
data lo_text type string.
lo_menu_item ?= WD_COMP_CONTROLLER->Z_VIEW_REF->get_element( 'OP1' ).
lo_maction ?= lo_menu_item.
CALL METHOD lo_maction->get_text
* EXPORTING
* as_external =
* context_element =
* context_node_path_name =
* text_length = CO_UNKNOWN_TEXTLEN
receiving
value = lo_text
.
OP1 is my menu action item ID.
in the lo_text you will have the "link" they right click on....
this was a little example i did where in my menu item i had urls....
thanks...
AS..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Have you tried looking in the WDEVENT?
I think it is of a type CL_WD_CUSTOM_EVENT?
It should have a method - GET_CONTEXT_ELEMENT which should give you information about the context element that raised the event.
Agreed - this doesn't give you any help in deciding which UI Element of the selected context element raised the event.
I'm guessing that you have two fields for which you can call the same menu, and you need to differentiate between the two...
I'd have to unfortunately suggest two different context menus - so you can identify between the two...
If you come up wiht a better solution - please do let us know.
Cheers,
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.