Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Right Click on Tree Node

Former Member
0 Kudos

I need to implement RIGHT CLICK event in tree node display, which is already contain drag&drop functionality.

I tried to register this RIGHT CLICK event in the same perform of drag and drop resgistration but it gives short dump with description ILLEGAL EVENT COMBINATION....

Please guide...

Siva.

5 REPLIES 5

Former Member
0 Kudos

Hi,

You need to register event "eventid_item_context_menu_req".

set the handler for method "handle_item_ctmenu_request" and "handle_item_ctmenu_selected".

Implement method handle_item_ctmenu_request

method handle_item_ctmenu_request .

call method menu->add_function

exporting fcode = 'USER1'

text = 'Usercmd 1'.

endmethod.

Above method will add the given input on right clock button popup.

Implement handle_item_ctmenu_selected

method handle_item_ctmenu_selected.

case fcode.

when 'USER1'.

when other.

endcase.

endmethod.

above method will be action of added input on right click popup.

Hope it will be helpful for you.

Regards,

Atul

0 Kudos

hi,

thanks , i solved my problem by reading this thread

0 Kudos

atul mishra

i solved the problem , how to rewd pts

Former Member
0 Kudos

Dear Siva,

You can follow the following steps:-

- Create local class (eg:- lcl_screen_handler) as handler class.

- Define and implement methods handle_node_context_menu_req and handle_node_context_menu_sel for handling right click.

- In Method handle_node_context_menu_req use CALL METHOD menu->add_function for adding entries to context menu.

- In Method handle_node_context_menu_sel based on node_key and fcode handle logic for right click.

- Define event handler (eg:- grc_event_handler TYPE REF TO lcl_screen_handler) to handle events for right click on tree.

- After creating Tree, specify events that are to be handled and assign them to tree instance

eg:- lwa_event-eventid = cl_simple_tree_model=>eventid_node_double_click.

lwa_event-appl_event = ' '. "system event, does not trigger PAI

APPEND lwa_event TO lit_event. (where, lit_event TYPE cntl_simple_events)

- Also, register PAI for context menu as follows:-

  • Process PAI if context menu select event occurs

CALL METHOD grc_tree->set_ctx_menu_select_event_appl (where grc_tree is Tree instance)

EXPORTING

appl_event = 'X'.

- Register Tree events as follows:-

CALL METHOD grc_tree->set_registered_events

EXPORTING

events = lit_event ....

- Create event handler instance for tree

CREATE OBJECT grc_event_handler. (where, grc_event_handler is already declared on top)

- Set event handler method to handle various events on tree node

eg:- SET HANDLER grc_event_handler->handle_node_double_click FOR grc_tree.

SET HANDLER grc_event_handler->handle_node_context_menu_req FOR grc_tree.

SET HANDLER grc_event_handler->handle_node_context_menu_sel FOR grc_tree.

The events should be handled now. I have followed this approach and it worked for me.

Regards,

Ashish

uwe_schieferstein
Active Contributor
0 Kudos

Hello Siva

Quite frequently this problem (ILLEGAL EVENT COMBINATION) is due to the fact that multiple selection of nodes / items is allowed yet a few of the registered events require a uniquely selected node or item. Calling context menus on multiple selected odes usually does not make sense. So check your CONSTRUCTOR method call.

Regards

Uwe