Posted: Sun Nov 04, 2007 7:57 pm Post subject: Demo: Picture Control: Icon display
Code:
program sap_picture_demo_icon.
set screen 200.
TYPE-POOLS cndp.
************************************************************************
* CLASS c_event_receiver
* DEFINITION
************************************************************************
class c_event_receiver definition.
* The class is used to test the events raised by the cl_gui_picture
* class
public section.
methods event_handler_control_click
for event control_click of cl_gui_picture
importing mouse_pos_x mouse_pos_y.
methods event_handler_control_dblclick
for event control_dblclick of cl_gui_picture
importing mouse_pos_x mouse_pos_y.
endclass.
************************************************************************
* DATA
************************************************************************
data function like sy-ucomm. " OK-Code field in screen 200
data event1(255) type c.
data picture_control_1 type ref to cl_gui_picture.
data picture_control_2 type ref to cl_gui_picture.
data container_1 type ref to cl_gui_custom_container.
data container_2 type ref to cl_gui_custom_container.
data event_receiver type ref to c_event_receiver.
data event_tab type cntl_simple_events.
data event type cntl_simple_event.
************************************************************************
* PBO
* before_output
************************************************************************
module before_output output.
set pf-status 'MAIN0001'.
IF PICTURE_CONTROL_1 IS INITIAL.
* Create the event_receiver object and set the handlers for the events
* of the picture controls
create object event_receiver.
set handler event_receiver->event_handler_control_dblclick
FOR PICTURE_CONTROL_1.
set handler event_receiver->event_handler_control_dblclick
FOR PICTURE_CONTROL_2.
set handler event_receiver->event_handler_control_click
FOR PICTURE_CONTROL_1.
set handler event_receiver->event_handler_control_click
FOR PICTURE_CONTROL_2.
************************************************************************
* PAI
* after_input
************************************************************************
module after_input input.
case function.
* At the end of the program destroy the control
when 'BACK'.
CALL METHOD PICTURE_CONTROL_1->FREE.
CALL METHOD PICTURE_CONTROL_2->FREE.
CALL METHOD container_1->FREE.
CALL METHOD container_2->FREE.
leave to screen 0.
* Clear the picture
when 'CLEAR'.
CALL METHOD PICTURE_CONTROL_1->CLEAR_PICTURE.
* Load a new picture
when space.
CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_SAP_ICONS
exporting icon = event1.
endcase.
clear function.
endmodule.
************************************************************************
* CLASS c_event_receiver
* IMPLEMENTATION
************************************************************************
CLASS C_event_receiver implementation.
************************************************************************
* CLASS c_event_receiver
* METHOD event_handler_control_click
************************************************************************
method event_handler_control_click.
* for event control_click of c_picture_control
* importing mouse_pos_x mouse_pos_y.
DATA pos_x(5) type c.
DATA pos_y(5) type c.
pos_x = mouse_pos_x.
pos_y = mouse_pos_y.
************************************************************************
* CLASS c_event_receiver
* METHOD event_handler_control_dblclick
************************************************************************
method event_handler_control_dblclick.
* for event control_dblclick of c_picture_control
* importing mouse_pos_x mouse_pos_y.
DATA pos_x(5) type c.
DATA pos_y(5) type c.
pos_x = mouse_pos_x.
pos_y = mouse_pos_y.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.