用事件类实现双击事件,实例化后使用set handler注册到ALV对象。斜体部分为事件方法的具体实现。
代码如下
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_node_double_click FOR EVENT node_double_click OF cl_gui_alv_tree
IMPORTING node_key sender.
ENDCLASS.
CLASS lcl_tree_event_receiver IMPLEMENTATION.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING new_code = 'BACK'.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
ENDCLASS.