Double click in ALV tree output????

Hi all,
I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
Please tell how to handle events in this report tree display.
For the following code its displaying output in tree format and in right way. But i need to add double click functionality to this.
So provide me some sample program for this one....
* create hierarchy
  CALL METHOD tree1->set_table_for_first_display
          EXPORTING
               it_list_commentary   = lt_list_commentary
               i_background_id      = 'ALV_BACKGROUND'
               i_save               = 'A'
               is_variant            = ls_variant
          CHANGING
               it_sort              = gt_sort[]
               it_outtab            = itab_outtab
               it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
* expand first level
  CALL METHOD tree1->expand_tree
         EXPORTING
             i_level = 1.
* optimize column-width
  CALL METHOD tree1->column_optimize
           EXPORTING
               i_start_column = tree1->c_hierarchy_column_name
               i_end_column   = tree1->c_hierarchy_column_name.
In grid ALV we can have double cilck functionality using code:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program       = w_repid
            i_callback_pf_status_set = 'PF_STATUS'
            i_callback_user_command  = 'USER_COMMAND'
            is_layout                = ls_layout
            it_fieldcat              = gt_fc[]
Here we can write subroutine for USER_COMMAND and handle the double click evenet. But tell me how to provide this in tree ALV.
<REMOVED BY MODERATOR>
Regards,
Sachin
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 1:47 PM

Hello Sachin
The following sample report ZUS_SDN_ALV_TREE_DEMO demonstrates the crucial parts for double-click event handling (nodes & items) in ALV trees.
*& Report  ZUS_SDN_ALV_TREE_DEMO
*& Thread: double click in ALV tree output????
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
REPORT  zus_sdn_alv_tree_demo.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knvv AS data.
TYPES: nkey       TYPE lvc_nkey.
TYPES: parent_key TYPE lvc_nkey.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.
DATA: gt_outtab    TYPE ty_t_outtab.
DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syst-repid,
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_tree          TYPE REF TO cl_gui_alv_tree.
*       CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
    handle_node_double_click
      FOR EVENT node_double_click OF cl_gui_alv_tree
      IMPORTING node_key,
    handle_item_double_click
      FOR EVENT item_double_click OF cl_gui_alv_tree
      IMPORTING node_key
                fieldname.
ENDCLASS.                    "lcl_eventhandler DEFINITION
*       CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
  METHOD handle_node_double_click.
    message 'Event=Double-Click on Node' type 'I'.
    call transaction 'XD03'.
  ENDMETHOD.                    "handle_node_double_click
  METHOD handle_item_double_click.
    message 'Event=Double-Click on Item' type 'I'.
    call transaction 'VA03'.
  ENDMETHOD.                    "handle_item_double_click
ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
  PERFORM init_controls.
  gd_repid = syst-repid.
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      container                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 3
      OTHERS                      = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CALL SCREEN '0100'.
** NOTE: no elements on screen
**  PROCESS BEFORE OUTPUT.
**    MODULE STATUS_0100.
**  PROCESS AFTER INPUT.
**    MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*&      Module  STATUS_0100  OUTPUT
*       text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
*       text
MODULE user_command_0100 INPUT.
  TRANSLATE gd_okcode TO UPPER CASE.
  CASE gd_okcode.
    WHEN 'BACK'  OR
         'EXIT'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.
    WHEN 'REFRESH'.
    WHEN OTHERS.
  ENDCASE.
  CLEAR: gd_okcode.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  init_controls
*       text
*  -->  p1        text
*  <--  p2        text
FORM init_controls .
* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=>screen0
      ratio  = 90
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* create tree control
  CREATE OBJECT go_tree
    EXPORTING
        parent              = go_docking
        node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
        item_selection      = 'X'  " required for double-click event on item
        no_html_header      = ''
        no_toolbar          = ''
    EXCEPTIONS
        cntl_error                   = 1
        cntl_system_error            = 2
        create_error                 = 3
        lifetime_error               = 4
        illegal_node_selection_mode  = 5
        failed                       = 6
        illegal_column_name          = 7.
  IF sy-subrc <> 0.
    MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
  ENDIF.
* create Hierarchy-header
  DATA ls_hierarchy_header TYPE treev_hhdr.
  PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
  PERFORM build_fieldcatalog.
  PERFORM set_layout_and_variant.
* create emty tree-control
  CALL METHOD go_tree->set_table_for_first_display
    EXPORTING
**      i_structure_name     = 'KNVV'
      is_variant           = gs_variant
      i_save               = 'A'
*      i_default            = 'X'
      is_hierarchy_header  = ls_hierarchy_header
*      is_exception_field   =
*      it_special_groups    =
*      it_list_commentary   =
*      i_logo               =
*      i_background_id      =
*      it_toolbar_excluding =
*      it_except_qinfo      =
    CHANGING
      it_outtab            = gt_outtab
*      it_filter            =
      it_fieldcatalog      = gt_fcat.
* create hierarchy
  PERFORM create_hierarchy.
* register events
  PERFORM register_events.
* adjust column_width
  CALL METHOD go_tree->column_optimize.
ENDFORM.                    " init_controls
*&      Form  build_hierarchy_header
*       build hierarchy-header-information
*      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
FORM build_hierarchy_header CHANGING
                               p_hierarchy_header TYPE treev_hhdr.
  p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
  p_hierarchy_header-tooltip =
                         'This is the Hierarchy Header !'.  "#EC NOTEXT
  p_hierarchy_header-width = 30.
  p_hierarchy_header-width_pix = ''.
ENDFORM.                               " build_hierarchy_header
*&      Form  BUILD_FIELDCATALOG
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_fieldcatalog .
  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'KNVV'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  DELETE gt_fcat FROM 8.
ENDFORM.                    " BUILD_FIELDCATALOG
*&      Form  SET_LAYOUT_AND_VARIANT
*       text
*  -->  p1        text
*  <--  p2        text
FORM set_layout_and_variant .
  CLEAR: gs_layout,
         gs_variant.
  gs_variant-report = syst-repid.
  gs_variant-handle = 'TREE'.
ENDFORM.                    " SET_LAYOUT_AND_VARIANT
*&      Form  create_hierarchy
*       text
*  -->  p1        text
*  <--  p2        text
FORM create_hierarchy .
  DATA: ls_knvv    TYPE sflight,
        ls_outtab  TYPE ty_s_outtab,
        lt_outtab  TYPE ty_t_outtab.
* get data
  SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                        UP TO 200 ROWS .                "#EC CI_NOWHERE
  SORT lt_outtab BY kunnr vkorg.
* add data to tree
  DATA: ld_kunnr_key TYPE lvc_nkey,
        ld_vkorg_key TYPE lvc_nkey,
        ld_last_key  TYPE lvc_nkey.
  LOOP AT lt_outtab INTO ls_outtab.
    ON CHANGE OF ls_outtab-kunnr.
      PERFORM add_customer_line USING    ls_outtab-data
                              CHANGING ld_kunnr_key.
    ENDON.
    ON CHANGE OF ls_outtab-vkorg.
      PERFORM add_salesorg_line USING    ls_outtab-data
                                         ld_kunnr_key
                              CHANGING ld_vkorg_key.
    ENDON.
    PERFORM add_complete_line USING  ls_outtab-data
                                     ld_vkorg_key
                            CHANGING ld_last_key.
  ENDLOOP.
* calculate totals
  CALL METHOD go_tree->update_calculations.
* this method must be called to send the data to the frontend
  CALL METHOD go_tree->frontend_update.
ENDFORM.                    " create_hierarchy
*&      Form  add_customer_line
*       add hierarchy-level 1 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value,
        ls_data TYPE ty_s_outtab-data.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-t_image = '@A0@'.  " icon_customer.
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=>style_intensifd_critical.
  APPEND ls_item_layout TO lt_item_layout.
* add node
  l_node_text =  us_data-kunnr.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = ls_data
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_customer_line
*&      Form  add_salesorg_line
*       add hierarchy-level 1 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value,
        ls_data TYPE ty_s_outtab-data.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=>style_intensifd_critical.
  APPEND ls_item_layout TO lt_item_layout.
* add node
  l_node_text =  us_data-vkorg.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = ls_data
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_salesorg_line
*&      Form  add_cmplete_line
*       add hierarchy-level 3 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
**  ls_item_layout-editable = 'X'.
  APPEND ls_item_layout TO lt_item_layout.
**  CLEAR ls_item_layout.
**  ls_item_layout-fieldname = 'PLANETYPE'.
**  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
**  APPEND ls_item_layout TO lt_item_layout.
  l_node_text =  us_data-vtweg.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      is_outtab_line   = us_data
      i_node_text      = l_node_text
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_complete_line
*&      Form  register_events
*       text
*  -->  p1        text
*  <--  p2        text
FORM register_events.
* define the events which will be passed to the backend
  DATA: lt_events TYPE cntl_simple_events,
        l_event TYPE cntl_simple_event.
* define the events which will be passed to the backend
  l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
**  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
  APPEND l_event TO lt_events.
  CALL METHOD go_tree->set_registered_events
    EXPORTING
      events                    = lt_events
    EXCEPTIONS
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  IF sy-subrc <> 0.
    MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
  ENDIF.
* set Handler
  set handler:
    lcl_eventhandler=>handle_node_double_click for go_tree,
    lcl_eventhandler=>handle_item_double_click for go_tree.
**  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
**  CREATE OBJECT l_event_receiver.
**  SET HANDLER l_event_receiver->handle_node_ctmenu_request
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_item_ctmenu_request
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
ENDFORM.                               " register_events
Regards
  Uwe

Similar Messages

  • Double Click on ALV Report Output, Bringing to selections creen

    Hello Gurus,
    Please help me When i do double click on ALV Report  output , it is going back to Selection screen, actually its working as Back button. Now how to stop it.. I did debugging but i cannot trace it.

    PERFORM SUB_CREATE_FCAT.
    DATA W_REPID LIKE SY-REPID.
        W_REPID = SY-REPID.
    ls_layout-colwidth_optimize = 'X'.
    ls_layout-zebra = 'X'.
    PERFORM SUB_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                 = SY-CPROG
          I_CALLBACK_PF_STATUS_SET          = 'STATUS'
           I_CALLBACK_USER_COMMAND           = 'C_USERCOMMAND '
    *     I_CALLBACK_TOP_OF_PAGE            = ' '
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
    *     I_STRUCTURE_NAME                  =
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
           IS_LAYOUT                         = ls_layout
           IT_FIELDCAT                       = IT_FIELDCAT
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
           IT_SORT                           = IT_SORT
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
    *     I_DEFAULT                         = 'X'
          I_SAVE                            = 'U'
    *     IS_VARIANT                        =
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    *     I_SCREEN_START_LINE               = 0
    *     I_SCREEN_END_COLUMN               = 0
    *     I_SCREEN_END_LINE                 = 0
    *     I_HTML_HEIGHT_TOP                 = 0
    *     I_HTML_HEIGHT_END                 = 0
    *     IT_ALV_GRAPHICS                   =
    *     IT_HYPERLINK                      =
    *     IT_ADD_FIELDCAT                   =
    *     IT_EXCEPT_QINFO                   =
    *     IR_SALV_FULLSCREEN_ADAPTER        =
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
         TABLES
           t_outtab                          = T_FINAL
    *   EXCEPTIONS
    *     PROGRAM_ERROR                     = 1
    *     OTHERS                            = 2
       IF sy-subrc <> 0.
    * Implement suitable error handling here
       ENDIF.

  • Double click in ALV tree display....

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    My code as of now is as below:
    Please tell how to handle events in this report tree display and how and where to write the code for this functionlity of double click.
    FORM alv_tree.
    PERFORM build_sort_table.  “----
    table is sorted
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      CREATE OBJECT l_custom_container
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            i_parent              = l_custom_container
            i_node_selection_mode =
                                  cl_gui_column_tree=>node_sel_mode_multiple
            i_item_selection      = 'X'
            i_no_html_header      = ''
            i_no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader.
      PERFORM build_comment USING
                     lt_list_commentary. “----
    already created
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    register events
      PERFORM register_events.
    create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    expand first level
      CALL METHOD tree1->expand_tree
             EXPORTING
                 i_level = 1.
    optimize column-width
      CALL METHOD tree1->column_optimize
               EXPORTING
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " alv_tree
    FORM register_events.
    define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    ENDFORM.                    " register_events

    hi
    (also check u have refresh the field)
    Check the demo program,In this double click the data fields it will display some field in screen,You can check it
    BCALV_GRID_DND_TREE
    Thanks
    Edited by: dharma raj on Jun 17, 2009 7:41 PM

  • Double Click in ALV TREE doesn't get triggered

    Hello All,
    Double click event on item in a alv tree report doesn't get triggered. I thought I was doing everything right. Please help me out.
    Look at the code below and tell me what else I need to do.
    <b>FORM register_events .
    Event registration: tell ALV Tree which events shall be passed
    from frontend to backend.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event,
            l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    Frontend registration:  get already registered tree events
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
    Frontend registration: add additional event ids
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
    Frontend registration: provide new event table to alv tree
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    Register events on backend (ABAP Objects event handling)
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->node_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->item_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->on_function_selected FOR g_toolbar.
    ENDFORM.                    " register_events</b>
    When I double click on item on the report double click event doesnt trigger. what could be the problem? Any sample programs?
    Thanks,
    Chandni

    Hi,
    Here is a sample code for you.
    report ztree.
    TABLES : vbak.
    DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
    INCLUDE STRUCTURE snodetext.
    DATA: END OF mylist.
    DATA: f15 TYPE c.
    DATA :
    BEGIN OF gt_sales OCCURS 0,
    vbeln LIKE vbak-vbeln,
    kunnr LIKE vbak-kunnr,
    matnr LIKE vbap-matnr,
    arktx LIKE vbap-arktx,
    END OF gt_sales.
    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
    START-OF-SELECTION.
    SET PF-STATUS 'ZTREE1'.
    SET TITLEBAR 'T1'.
    Fill internal table with pseudo-data
    PERFORM fill_itab.
    Hierarchy output
    PERFORM main.
    *& Form FILL_ITAB
    text
    --> p1 text
    <-- p2 text
    FORM fill_itab .
    *Fill the gt_sales table
    SELECT vkvbeln vkkunnr vpmatnr vparktx INTO CORRESPONDING FIELDS OF
    TABLE gt_sales
    FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
    WHERE vk~vbeln IN s_vbeln.
    SORT gt_sales BY vbeln kunnr.
    *Fill the root
    mylist-name = 'Report Tree List'.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = 'Report Tree List'.
    mylist-tlength = 16.
    mylist-tlevel = 1.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
    mylist-tlength1 = 50.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    LOOP AT gt_sales.
    ON CHANGE OF gt_sales-vbeln.
    mylist-name = 'level1'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Sales Document no:'.
    mylist-tlength = 20.
    mylist-tlevel = 2.
    mylist-tcolor = 7.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-vbeln.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    ON CHANGE OF gt_sales-kunnr.
    mylist-name = 'level2'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Customer no:'.
    mylist-tlength = 20.
    mylist-tlevel = 3.
    mylist-tcolor = 5.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-kunnr.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 3.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    mylist-name = 'level3'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = gt_sales-matnr.
    mylist-tlength = 15.
    mylist-tlevel = 4.
    mylist-tcolor = 4.
    mylist-tintensiv = '0'.
    mylist-text1 = gt_sales-arktx.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDLOOP.
    ENDFORM. " FILL_ITAB
    *& Form MAIN
    text
    --> p1 text
    <-- p2 text
    FORM main .
    PERFORM hierarchy. " construct & draw the tree
    ENDFORM. " MAIN
    *& Form HIERARCHY
    text
    --> p1 text
    <-- p2 text
    FORM hierarchy .
    PERFORM build_tree.
    PERFORM draw_tree.
    ENDFORM. " HIERARCHY
    FORM BUILD_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_CONSTRUCT *
    FORM build_tree.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = mylist
    EXCEPTIONS
    tree_failure = 1.
    ENDFORM. "build_tree
    FORM DRAW_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_DISPLAY *
    FORM draw_tree.
    sy-lsind = 0.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    callback_program = 'ZREPORT_TREE'
    callback_user_command = 'NODE_SELECT'
    IMPORTING
    f15 = f15.
    ENDFORM. "draw_tree
    FORM NODE_SELECT *
    Handles selection of nodes *
    FORM node_select TABLES knoten STRUCTURE seucomm
    USING command
    CHANGING exit
    list_refresh.
    Processing of commands for hierarchy list
    CASE command.
    WHEN 'DISP'.
    CASE knoten-id.
    WHEN '000002'.
    *Display Sales Order
    SET PARAMETER ID 'AUN' FIELD knoten-text1.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '000003'.
    *Display Customer
    SET PARAMETER ID 'KUN' FIELD knoten-text1.
    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDCASE.
    list_refresh = 'X'.
    ENDFORM. "node_select

  • Double Click on ALV Tree

    Hi All,
    I am displaying the output of my report in ALV Tree form displaying Plant, Functional Location,
    Equipment, Order as Levels.
    The Requirement is when i double click on the order number, it should navigate to the Details of the Order i.e. navigate to Transaction IW33.
    I have used the Function Module "RS_TREE_LIST_DISPLAY" for displaying my ALV output as below :
        CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
          EXPORTING
            CALLBACK_PROGRAM      = 'ZPM714'.
    Please suggest me for this.
    Thanks & Regards,
    Bhavika

    Hi Pavan,
    Please find the code below :
    FORM BUILD_TREE .
      CLEAR : WA_NODE, WT_NODE[], WT_NODE.
    ***Building ALV Tree maintaining the Hierarchy of Plant,Functional Location,Equipment Number,& Object Number
      WA_NODE-TYPE = 'T'.
      WA_NODE-NAME = 'Plant'.
      WA_NODE-TLEVEL = '01'.
      WA_NODE-NLENGTH = '15'.
      WA_NODE-COLOR = '5'.
    WA_NODE-TPOS = '45'.
      WA_NODE-TPOS = '85'.
      WA_NODE-TEXT = 'Actual Costs'.
      WA_NODE-TLENGTH = '15'.
      WA_NODE-TCOLOR = '3'.
    WA_NODE-TPOS1 = '60'.
      WA_NODE-TPOS1 = '100'.
      WA_NODE-TEXT1 = 'Planned Costs'.
      WA_NODE-TLENGTH1 = '20'.
      WA_NODE-TCOLOR1 = '3'.
      APPEND WA_NODE TO WT_NODE.
      CLEAR WA_NODE.
      LOOP AT WT_P.
        WA_NODE-TYPE = 'P'.
        WA_NODE-TLEVEL = '02'.
        WA_NODE-TEXT = WT_P-WERKS.
        WA_NODE-TLENGTH = '15'.
        WA_NODE-TCOLOR = '1'.
        CLEAR WV_VALUE.
        WV_VALUE = WT_P-WTGBTR.
        CONDENSE WV_VALUE.
        WA_NODE-TEXT1 = WV_VALUE.
        WA_NODE-TLENGTH1 = '15'.
        WA_NODE-TCOLOR1 = '1'.
       WA_NODE-TPOS1 = '45'.
        WA_NODE-TPOS1 = '85'.
        CLEAR WV_VALUE.
        WV_VALUE = WT_P-WTG001.
        CONDENSE WV_VALUE.
        WA_NODE-TEXT2 = WV_VALUE.
        WA_NODE-TLENGTH2 = '15'.
        WA_NODE-TCOLOR2 = '1'.
       WA_NODE-TPOS2 = '60'.
        WA_NODE-TPOS2 = '100'.
        APPEND WA_NODE TO WT_NODE.
        CLEAR WA_NODE.
        LOOP AT WT_FL WHERE WERKS = WT_P-WERKS.
          WA_NODE-TYPE = 'P'.
          WA_NODE-TLEVEL = '03'.
         WA_NODE-TEXT = WT_FL-ILOAN.
          WA_NODE-TEXT = WT_FL-TPLNR.
         WA_NODE-TLENGTH = '12'.
          WA_NODE-TLENGTH = '30'.
          WA_NODE-TCOLOR = '1'.
          CLEAR WV_VALUE.
          WV_VALUE = WT_FL-AC.
          CONDENSE WV_VALUE.
          WA_NODE-TEXT1 = WV_VALUE.
          WA_NODE-TLENGTH1 = '15'.
          WA_NODE-TCOLOR1 = '1'.
         WA_NODE-TPOS1 = '45'.
          WA_NODE-TPOS1 = '85'.
          CLEAR WV_VALUE.
          WV_VALUE = WT_FL-PC.
          CONDENSE WV_VALUE.
          WA_NODE-TEXT2 = WV_VALUE.
          WA_NODE-TLENGTH2 = '15'.
          WA_NODE-TCOLOR2 = '1'.
         WA_NODE-TPOS2 = '60'.
          WA_NODE-TPOS2 = '100'.
          APPEND WA_NODE TO WT_NODE.
          CLEAR WA_NODE.
          LOOP AT WT_EQ WHERE WERKS = WT_FL-WERKS AND
                             FUNC_LOC = WT_FL-ILOAN.
                              TPLNR = WT_FL-TPLNR.
            WA_NODE-TYPE = 'P'.
            WA_NODE-TLEVEL = '04'.
            WA_NODE-TEXT = WT_EQ-EQUNR.
            WA_NODE-TLENGTH = '18'.
            WA_NODE-TCOLOR = '1'.
            WA_NODE-TEXT1 = WT_EQ-EQKTX.
            WA_NODE-TLENGTH1 = '40'.
            WA_NODE-TCOLOR1 = '1'.
           WA_NODE-TPOS1 = '45'.
            WA_NODE-TPOS1 = '40'.
            CLEAR WV_VALUE.
            WV_VALUE = WT_EQ-AC.
            CONDENSE WV_VALUE.
            WA_NODE-TEXT2 = WV_VALUE.
            WA_NODE-TLENGTH2 = '15'.
            WA_NODE-TCOLOR2 = '1'.
           WA_NODE-TPOS1 = '45'.
            WA_NODE-TPOS2 = '85'.
            CLEAR WV_VALUE.
            WV_VALUE = WT_EQ-PC.
            CONDENSE WV_VALUE.
            WA_NODE-TEXT3 = WV_VALUE.
            WA_NODE-TLENGTH3 = '15'.
            WA_NODE-TCOLOR3 = '1'.
           WA_NODE-TPOS2 = '60'.
            WA_NODE-TPOS3 = '100'.
            APPEND WA_NODE TO WT_NODE.
            CLEAR WA_NODE.
            LOOP AT WT_OB WHERE WERKS = WT_EQ-WERKS AND
                               FUNC_LOC = WT_EQ-FUNC_LOC AND
                                TPLNR = WT_EQ-TPLNR AND
                                EQUNR    = WT_EQ-EQUNR.
              WA_NODE-TYPE = 'P'.
              WA_NODE-TLEVEL = '05'.
             WA_NODE-TEXT = WT_OB-OBJNR.
              WA_NODE-TEXT = WT_OB-AUFNR.
             WA_NODE-TLENGTH = '22'.
              WA_NODE-TLENGTH = '12'.
              WA_NODE-TCOLOR = '1'.
              WA_NODE-TEXT1 = WT_OB-KTEXT.
              WA_NODE-TLENGTH1 = '40'.
              WA_NODE-TCOLOR1 = '1'.
             WA_NODE-TPOS1 = '45'.
              WA_NODE-TPOS1 = '40'.
              CLEAR WV_VALUE.
              WV_VALUE = WT_OB-AC.
              CONDENSE WV_VALUE.
              WA_NODE-TEXT2 = WV_VALUE.
              WA_NODE-TLENGTH2 = '15'.
              WA_NODE-TCOLOR2 = '1'.
             WA_NODE-TPOS1 = '45'.
              WA_NODE-TPOS2 = '85'.
              CLEAR WV_VALUE.
              WV_VALUE = WT_OB-PC.
              CONDENSE WV_VALUE.
              WA_NODE-TEXT3 = WV_VALUE.
              WA_NODE-TLENGTH3 = '15'.
              WA_NODE-TCOLOR3 = '1'.
             WA_NODE-TPOS2 = '60'.
              WA_NODE-TPOS3 = '100'.
              APPEND WA_NODE TO WT_NODE.
              CLEAR WA_NODE.
              LOOP AT WT_CE WHERE AUFNR = WT_OB-AUFNR.
                WA_NODE-TYPE = 'P'.
                WA_NODE-TLEVEL = '06'.
                WA_NODE-TEXT = WT_CE-KSTAR.
                WA_NODE-TLENGTH = '10'.
                WA_NODE-TCOLOR = '1'.
                CLEAR WV_VALUE.
                WV_VALUE = WT_CE-AC.
                CONDENSE WV_VALUE.
                WA_NODE-TEXT1 = WV_VALUE.
                WA_NODE-TLENGTH1 = '15'.
                WA_NODE-TCOLOR1 = '1'.
                WA_NODE-TPOS1 = '85'.
                CLEAR WV_VALUE.
                WV_VALUE = WT_CE-PC.
                CONDENSE WV_VALUE.
                WA_NODE-TEXT2 = WV_VALUE.
                WA_NODE-TLENGTH2 = '15'.
                WA_NODE-TCOLOR2 = '1'.
                WA_NODE-TPOS2 = '100'.
                APPEND WA_NODE TO WT_NODE.
                CLEAR WA_NODE.
              ENDLOOP.
            ENDLOOP.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " BUILD_TREE
    *&      Form  DISPLAY_TREE
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_TREE .
    **Constructing the ALV Tree using Func Mod RS_TREE_CONSTRUCT*
      CALL FUNCTION 'RS_TREE_CONSTRUCT'
    EXPORTING
      INSERT_ID                = '000000'
      RELATIONSHIP             = ' '
      LOG                      =
        TABLES
          NODETAB                  = WT_NODE
       EXCEPTIONS
         TREE_FAILURE             = 1
         ID_NOT_FOUND             = 2
         WRONG_RELATIONSHIP       = 3
         OTHERS                   = 4
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    **Displaying the ALV Tree using Func Mod RS_TREE_LIST_DISPLAY*
      IF WT_FINAL_TEMP[] IS INITIAL.
        MESSAGE 'No Data Available' TYPE 'S'.
      ELSE.
        CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
          EXPORTING
            CALLBACK_PROGRAM      = 'ZPM714'
           CALLBACK_USER_COMMAND = 'USER_COMMAND'
      ENDIF.
    ENDFORM.                    " DISPLAY_TREE
    Regards,
    Bhavika

  • Double click in alv tree

    hi!
    I wrote an ALV report using some parts of the code from BCALV_TREE_DEMO.
    I added a new icon to the status of the screen.
    I want to add a function that when standing on the line with cursor and then  pressing the new button,  I will use the call transaction passing some of the values from the line which i selected to the call transaction.
    how can i do it?
    If someone has a code for it , it will be great.
    thanks
    Yifat

    Hi,
    You can use the method " GET_SELECTED_ITEM "/ "GET_SELECTED_NODES " of CL_GUI_ALV_TREE to identify the selected items. I am assuming that you have used this class to construct your tree.
    How you identify the item depends on the logic you used to construct your tree i,e if you have somehow stored the info of the node you select on the tree.
    For ex, you have a tree displaying Sales orders. You can either give the NODE KEY as the Sales ord num itself or you may give the sales order num in the NODE TEXT so that you can retrieve that later.
    Take a look at SLIS package for detailed examples on ALV tree's.
    Now regarding the call transaction part, you can use the below format :
          set parameter id 'VL' field [your_field].
          call transaction 'VL03N' and skip first screen.
    Identify your field & the transaction.
    Regards,
    Sharat.

  • On Double Clicking An ALV

    Hi ALL,
    I have a doubt in ALV,
    My requirement is that, I developed one ALV report.
    Now when i double click one field i have to show some fields in a new report.
    How this can be done.
    Thanks & Regards,
    Pradeep Alex

    BC ALV report will help you using OOABAP.
    any method you want to use, what you need to do is pass a subroutine name to the  USER_COMMAND method. either directly in the  ALV FM export parameter or in the event table.
    in this subroutine which you have defined for USER_COMMAND, do what ever code you want. this will trigger when you double click the ALV output.

  • Editable field in alv tree output using cl_gui_alv_tree

    Hi,
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree.
    regards,
    Naresh

    sadly, this is not possible. An ALV Tree cannot by editable.
    Regards

  • Double click in ALV.

    How do I execute Double click event in grid and list disaplay?

    Hi
    Kindly check the following threads:
    Re: Double click event of alv grid control
    double click on alv grid
    Re: Using double click event in ALV Grid
    you can find some code samples from the above links.
    Hope this helps!
    best regards,
    Thangesh

  • Double click in alv list

    Hi all,
    Here is the code:
    my aim is to double click the alv list and display the correspoonding data .can any one tell me how to solve this.
    regards,
    Lisa
    Message was edited by: Lisa Roy

    Hi Lisa,
    **-ALV list Display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
       <b>   I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'</b>
        <b>  I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'</b>
          IS_LAYOUT                = X_LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT
          IT_EVENTS                = IT_EVENTS
        TABLES
          T_OUTTAB                 = IT_FINAL
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    you need to pass these two forms
    FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
    ENDFORM.                    "PF_STATUS_SET
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE
                                                             SLIS_SELFIELD.
    case UCOMM.
    when '&IC1'.  "this is for double click.
    "do some thing..
      ENDCASE.
    ENDFORM.                    "USER_COMMAND

  • Double Click in ALV Report in Web dynpro ABAP4

    Hi All,
    I am very much new to WDA4 , can anybody plz guide me how to enable double click in ALV Report in Web dynpro ..
    Plz help it is urgent .....
    Thnks
    Sahil

    Hi All,
    I am very much new to WDA4 , can anybody plz guide me how to enable double click in ALV Report in Web dynpro ..
    Plz help it is urgent .....
    Thnks
    Sahil

  • ALV Tree Output

    Hi,
    In my present project we have requirement for developing ALV tree output using ALV configuration model in WD4A. Please provide sample code or tutorial related to ALV Tree development in WebDynpro ABAP.
    Best regards,
    Alleiah

    Hi Alleiah Marabathini ,
    The following r excellent websites containing ONLY PDF docs on ALV Tree in WebDynpro ABAP:
    Simple Example for Using ALV in Web Dynpro for ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3439404a-0801-0010-dda5-8c14514d690d
    Programming the ALV Configuration Model in Web Dynpro for ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9
    Editing ALV in Web Dynpro for ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1
    Using Events with ALV Tables in Web Dynpro for ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82d3e8
    Using ALV with a Dynamic Context Node in Web Dynpro for ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783
    cheers!
    gyanaraj

  • Editable field with F4 help in alv tree output using cl_gui_alv_tree

    HI
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
    Regards
    Naresh

    Hi Naresh,
    Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
    for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • Double Click to Activate Tree Item Editor

    Hi, I have an mx:Tree that uses an MXML component as an item
    editor. I only want to activate the editor when the user double
    clicks on a tree's node. As a default, a single click will open the
    the item editor on the Tree list. Can anyone help me with
    this?

    I am pretty sure it is possible, but I have not done it. You
    will probably need to cancel the default behavior of click event.
    Tracy

  • How to trigger event when double click on a tree node

    I have this code which creates new tab in a remote Java Class.
    treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<String>>()
       @Override
       public void changed(ObservableValue<? extends TreeItem<String>> observable, TreeItem<String> oldValue, TreeItem<String> newValue)
       System.out.println("Selected Text : " + newValue.getValue());
       // Create New Tab
       Tab tabdata = new Tab();
       Label tabALabel = new Label("Test");
      tabdata.setGraphic(tabALabel);
       DataStage.addNewTab(tabdata);
    Can you tell me how I can modify the code to open new tab when I double click on a tree node. In my code the tab is opened when I click once. What event handler do I need?

    import java.util.Arrays;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.StackPane;
    import javafx.scene.control.TreeCell;
    import javafx.scene.control.TreeView;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.SelectionMode;
    import javafx.util.Callback;
    public class TreeTest extends Application {
      public static void main(String[] args) {
        launch(args);
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("TreeView Test");
        primaryStage.setScene(createScene());
        primaryStage.show();
      private Scene createScene() {
        final StackPane stackPane = new StackPane();
        final TreeView<String> treeView = new TreeView<String>();
        treeView.setRoot(createModel());
        treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        treeView.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
          @Override
          public TreeCell<String> call(TreeView<String> treeView) {
            return new ClickableTreeCell();
        stackPane.getChildren().add(treeView);
        return new Scene(stackPane);
      private TreeItem<String> createModel() {
        TreeItem<String> root = new TreeItem<String>("RootNode");
        TreeItem<String> packageA = new TreeItem<String>("package A");
        packageA.getChildren().addAll(
            Arrays.asList(new TreeItem<String>("A1"), new TreeItem<String>("A2"), new TreeItem<String>("A3"))
        TreeItem<String> packageB = new TreeItem<String>("package B");
        packageB.getChildren().addAll(
            Arrays.asList(new TreeItem<String>("B1"), new TreeItem<String>("B2"), new TreeItem<String>("B3"))
        root.getChildren().addAll(Arrays.asList(packageA, packageB));
        return root;
      private class ClickableTreeCell extends TreeCell<String> {
        ClickableTreeCell() {
          setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
              // Handle double-clicks on non-empty cells:
              if (event.getClickCount()==2 && ! isEmpty()) {
                System.out.println("Mouse double-clicked on: " + getItem());
        @Override
        protected void updateItem(String item, boolean empty) {
          super.updateItem(item, empty);
          if (empty) {
            setText(null);
          } else {
            setText(item);

Maybe you are looking for

  • Block Active X on Browser Preview (~!@#$%^&*)

    Hello again... Whenever I attempt to preview web page design changes in my browser (IE7), the Block Active X header appears at the top of the browser window...warning me about possible malicious content...asking me to click for options...& then givin

  • Nokia suite does not recognize my Internet connect...

    My Nokia Suite doesn't recognize the Internet Connection available with my desktop.  Though I'm able to access the internet, my suite says "No Internet Connection Available". Any pointers to resolve this?? Plz help I use Nokia Suite 3.3.86 ~Cheers, K

  • How do I add and subtract cd's from my 7th gen nano

    I have used various mp3 players with my windows player succesfully for many years. But for Xmas I was given an ipod nano 7th generation because I wanted to use blue tooth headphones. However I find itunes/the device impossible to use and the manual d

  • How do I get dashboard widgets on the desktop again?

    I used to have the stock ticker widget on my desktop all the time, but after I upgraded it disappeared. I used to be able to go into dashboard, clock and hold on a widget, then exit dashboard, and the widget would move to my desktop. Where/why has th

  • Create Descriptive Flexfield Structure

    All, I am wondering if it is possbile to create a descriptive flexfield structure to be added to a form flexfield instead of having the flexfields segments added seperately. Example: Currently: Flexfield 1 Yes Flexfield 2 Yes Flexfield 3 Yes Flexfiel