CL_GUI_ALV_GRID 取消右鍵功能

首先宣告EVENT_RECEIVER
DATA: GRID TYPE REF TO CL_GUI_ALV_GRID,
EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.

再寫code,重點在event CONTEXT_MENU_REQUEST,將 E_OBJECT清空
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_CONTEXT_MENU_REQUEST
FOR EVENT CONTEXT_MENU_REQUEST OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT.
ENDCLASS.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_CONTEXT_MENU_REQUEST.
CALL METHOD E_OBJECT->CLEAR.
ENDMETHOD.
ENDCLASS.

再來就是將event掛到grid去
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_CONTEXT_MENU_REQUEST FOR GRID.

你可能感兴趣的:(CL_GUI_ALV_GRID 取消右鍵功能)