Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

to catch click event on a picture on screen

How to catch the click event on a picture on screen? Please answer with code.

regards

agn

Former Member
Former Member replied

Try this code....

REPORT zaby_pic.

CLASS cl_picture_click DEFENITION.

PUBLIC SECTION.

METHODS: picture_yclick FOR EVENT picture_click of cl_gui_picture IMPORTING mouse_pos_x mouse_pos_y.

ENDCLASS.

CLASS cl_picture_click IMPLEMENTATION.

METHOD: picture_yclick.

Perform onclick. "write the action of click in this form.

ENDMETHOD.

ENDCLASS.

DATA: obj_cl_picture_class TYPE REF TO cl_picture_click.

DATA: it_event_picture TYPE TABLE OF cntl_simple_event,

wa_event_picture TYPE cntl_simple_event.

MODULE status_001_output.

wa_event_picture-eventid = cl_gui_picture=>eventid_picture_click.

wa_event_picture-appl_event = 'X'.

APPEND wa_event_picture to it_event_picture.

CALL METHOD h_picture->set_registered_events

Exporting

events = it_evet_picture

Exceptions

cntl_error = 1

cntl_system_error = 2

illegal_event_combination = 3

OTHERS = 4.

CREATE OBJECT obj_cl_picture_click.

SET HANDLER obj_cl_picture_click->picture_yclick FOR h_picture. "h_picture is the object of class cl_gui_picture.

ENDMODULE

...................Hope this code will help you. Thanks.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question