Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

left splitter container with tree control and toolbar

Former Member
0 Kudos

I have a splitter container, what I have actualle is


  CREATE OBJECT mytoolbar
    EXPORTING
      parent       = container_1
      display_mode = cl_gui_toolbar=>m_mode_vertical.

  PERFORM fill_data_table
    USING:
    'FC2' '@00@' cntb_btype_button  text-001
    'text-001',
    'FC3' '@5B@' cntb_btype_button  'text-001'
    'text-001',
    'FC4' '@5C@' cntb_btype_button  'text-001'
    'text-001',
    'FC5' '@5D@' cntb_btype_button  'text-001'
    'text-001',
    'FC6' '@12@' cntb_btype_button  'text-001'
    'text-001'.

  CALL METHOD mytoolbar->add_button_group
    EXPORTING
      data_table = buttongroup.

FORM fill_data_table
         USING
               fcode  TYPE ui_func
               icon   TYPE iconname
               type   TYPE tb_btype
               text   TYPE text40
               tip    TYPE iconquick.

  CALL METHOD mytoolbar->fill_buttons_data_table
    EXPORTING
      fcode      = fcode
      icon       = icon
      butn_type  = type
      text       = text
      quickinfo  = tip
    CHANGING
      data_table = buttongroup.




and this:


  CREATE OBJECT G_CUSTOM_CONTAINER
    EXPORTING
      " the container is linked to the custom control with the
      " name 'TREE_CONTAINER' on the dynpro
      CONTAINER_NAME = 'CONTAINER'
    EXCEPTIONS
      CNTL_ERROR = 1
      CNTL_SYSTEM_ERROR = 2
      CREATE_ERROR = 3
      LIFETIME_ERROR = 4
      LIFETIME_DYNPRO_DYNPRO_LINK = 5.
  IF SY-SUBRC <> 0.
*    MESSAGE A000.
  ENDIF.


* create a tree control
  CREATE OBJECT G_TREE
    EXPORTING
      PARENT              = Container_1
      " single node selection is used
      NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE
    EXCEPTIONS
      LIFETIME_ERROR              = 1
      CNTL_SYSTEM_ERROR           = 2
      CREATE_ERROR                = 3
      FAILED                      = 4
      ILLEGAL_NODE_SELECTION_MODE = 5.
  IF SY-SUBRC <> 0.
*    MESSAGE A000.
  ENDIF.

  PERFORM BUILD_NODE_TABLE USING NODE_TABLE.

  CALL METHOD G_TREE->ADD_NODES
    EXPORTING
      TABLE_STRUCTURE_NAME = 'MTREESNODE'
      NODE_TABLE           = NODE_TABLE
    EXCEPTIONS
      FAILED                         = 1
      ERROR_IN_NODE_TABLE            = 2
      DP_ERROR                       = 3
      TABLE_STRUCTURE_NAME_NOT_FOUND = 4
      OTHERS                         = 5.
  IF SY-SUBRC <> 0.
*    MESSAGE A000.
  ENDIF.


FORM BUILD_NODE_TABLE
  USING
    NODE_TABLE TYPE NODE_TABLE_TYPE.


  DATA: NODE LIKE MTREESNODE.

* Build the node table.

* Node with key 'Root'
  NODE-NODE_KEY = c_nodekey-Root.
                            " Key of the node
  CLEAR NODE-RELATKEY.      " Special case: A root node has no parent
  CLEAR NODE-RELATSHIP.     " node.

  NODE-HIDDEN = ' '.        " The node is visible,
  NODE-DISABLED = ' '.      " selectable,
  NODE-ISFOLDER = 'X'.      " a folder.
  CLEAR NODE-N_IMAGE.       " Folder-/ Leaf-Symbol in state "closed":
                            " use default.
  CLEAR NODE-EXP_IMAGE.     " Folder-/ Leaf-Symbol in state "open":
                            " use default
  CLEAR NODE-EXPANDER.      " see below.
  NODE-TEXT = 'Root'(roo).
  APPEND NODE TO NODE_TABLE.
endform.                    " BUILD_NODE_TABLE

The problem is that I can either display the toolbar or the tree control, but how can I use both in my splitter container?

5 REPLIES 5

uwe_schieferstein
Active Contributor
0 Kudos

Hello Muhammet

You need a splitter container in order to display multiple controls. My suggestion:

  • Create a docking container and link it to your container element on the screen

  • Use the docking container as parent for a splitter container having 2 rows and 1 column

  • Fetch the top container of the splitter and use it as parent for your toolbar control

  • Fetch the bottom container of the splitter and use it as parent for your tree control

For an example using the splitter container have a look at sample report ZUS_SDN_TWO_ALV_GRIDS in

Regards

Uwe

0 Kudos

but when I fetch container_1 I have

container1_1

container1_2

and so I have a line which I can pull. I dont want a line between these both tools toolbar and tree control or did you mean something else?

MarcinPciak
Active Contributor
0 Kudos

Hi,

You can use splitter container as below:


"splitter container
data: g_splitter_container TYPE REF TO cl_gui_splitter_container,
"custom container
 g_custom_container TYPE REF TO cl_gui_custom_container,
 "gui containers
 g_top_container TYPE REF TO cl_gui_container,
 g_bottom_container TYPE REF TO cl_gui_container,

"create custom container placed in CUSTOM AREA defined on screen
    CREATE OBJECT g_custom_container
      EXPORTING
        container_name              = 'CUSTOM_AREA'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        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.

    "now split the container into two independent containers
    CREATE OBJECT g_splitter_container
      EXPORTING
         parent            = g_custom_container
         rows              = 2
         columns           = 1
      EXCEPTIONS
        cntl_error        = 1
        cntl_system_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.

    "get top container
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 1
        column    = 1
      RECEIVING
        container = g_top_container.

    "get bottom container 
    CALL METHOD g_splitter_container->get_container
      EXPORTING
        row       = 2
        column    = 1
      RECEIVING
        container = g_bottom_container.

"Now simply place your toolbar at top container
  CREATE OBJECT mytoolbar
    EXPORTING
      parent       = g_top_container
      display_mode = cl_gui_toolbar=>m_mode_vertical.

"..and your gui in bottom
CREATE OBJECT G_TREE
    EXPORTING
      PARENT              = g_bottom_container
      " single node selection is used
      NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE
...

Regards

M.

0 Kudos

OK I did it like this, I split the container and put the type of the line to false, so I can't move the line

CALL METHOD splitter3->set_row_sash

EXPORTING

id = 1

type = cl_gui_splitter_container=>type_movable

value = cl_gui_splitter_container=>false.

0 Kudos

Thank you for your answers.