- OOALV的双击事件通过cl_gui_alv_grid内置事件double_click实现,效果如下图显示
- 实现步骤:不需要像单击事件那样需要热点
- 定义一个事件处理类及其操作处理
CLASS cl_event DEFINITION. PUBLIC SECTION. METHODS handle_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row "双击单元格的行信息 e_column "双击单元格的列形象 es_row_no. "行编号 ENDCLASS. CLASS cl_event IMPLEMENTATION. METHOD handle_double_click. DATA lv_index TYPE i. lv_index = e_row-index. MESSAGE '双击了第' && lv_index && '行' TYPE 'I'. ENDMETHOD. ENDCLASS.
- 通过事件处理类的实例对象给OOALVDUI的实例对象设置注册事件
CREATE OBJECT go_con EXPORTING container_name = 'CONTORL'. CREATE OBJECT go_alv EXPORTING I_parent = go_con. DATA(lo_event) = NEW cl_event( ). SET HANDLER lo_event->handle_double_click FOR go_alv.