sapdev logo background
sapdev logo sapdev logo
Comments

Create and register events for user interaction





* Add following code to 'STATUS_0100'(PBO module)
*-----------------------------------------------*
* Create tree control
PERFORM define_events.


* Add following code to 'Z......F01' INCLUDE
*-------------------------------------------*
*&-------------------------------------------------------------*
*&      Form  DEFINE_EVENTS
*&-------------------------------------------------------------*
*       Define user events
*--------------------------------------------------------------*
form define_events .
  data: EVENTS TYPE CNTL_SIMPLE_EVENTS,
        event type cntl_simple_event.

* define the events which will be passed to the backend
  " node double click
  event-eventid = CL_GUI_SIMPLE_TREE=>EVENTID_NODE_DOUBLE_CLICK.
  event-appl_event = 'X'. " process PAI if event occurs
  APPEND event to events.

  " expand no children
  event-eventid = CL_GUI_SIMPLE_TREE=>EVENTID_EXPAND_NO_CHILDREN.
  event-appl_event = 'X'.
  APPEND event to events.

  CALL METHOD GD_TREE->SET_REGISTERED_EVENTS
    EXPORTING
      EVENTS = EVENTS
    EXCEPTIONS
      CNTL_ERROR                = 1
      CNTL_SYSTEM_ERROR         = 2
      ILLEGAL_EVENT_COMBINATION = 3.


* assign event handlers in the application class to each desired event
  SET HANDLER GD_APPLICATION->HANDLE_NODE_DOUBLE_CLICK FOR GD_TREE.
  SET HANDLER GD_APPLICATION->HANDLE_EXPAND_NO_CHILDREN FOR GD_TREE.

endform.                    " define_events



comments powered by Disqus