Application Development and Automation 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: 
Read only

ABAP Objects: Problems with controls in splitter container

Former Member
0 Likes
1,888

Hi community,

I have problems with the second control in a splitter container.

In the left container I build up a <u>list tree</u>.

On double click on a node a <u>column tree</u> in the right container is created.

This is working fine.

But if I double click on another node in the left container the right tree remains unchanged.

What do I have to do to update/refresh the tree in the right splitter container.

Thanks in advance.

Regards

Ferdi

1 ACCEPTED SOLUTION
Read only

thomas_jung
Developer Advocate
Developer Advocate
0 Likes
1,714

I assume that the event handler tied to your Left Column Tree - Double Click sets some flag that causes your right container and tree to be created. However a second click on the Left does nothing. Have you tried calling the free method of all the controls on the right side and clearing their object references in the left column tree's event handler.

Justing calling the create methods won't refresh the objects if they already exsist. You have to destroy them first.

10 REPLIES 10
Read only

thomas_jung
Developer Advocate
Developer Advocate
0 Likes
1,715

I assume that the event handler tied to your Left Column Tree - Double Click sets some flag that causes your right container and tree to be created. However a second click on the Left does nothing. Have you tried calling the free method of all the controls on the right side and clearing their object references in the left column tree's event handler.

Justing calling the create methods won't refresh the objects if they already exsist. You have to destroy them first.

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,714

Hi

I guess you have a conditional check to build the righthand tree as "IF x IS INITIAL ." where x is the column tree object or the custom container object and between this IF-ENDIF you build your tree. Your problem may be caused from this check since as Thomas told the column tree instance is not destroyed. Then, assuming you have a flag as "gv_refresh_right_tree" which have 'X' when a double-click action is triggered at right and cleared after refresh of left tree, revise your condition as "IF x IS INITIAL OR NOT gv_refresh_right_tree IS INITIAL" and add "CLEAR gv_refresh_right_tree." after tree-building procedure. Now, when you double click a node at left your righthand tree should be rebuilt. For sake of performance, you may want not to refresh the right tree when the same node is double-clicked. Then you should add a new condition.

Hope this addition helps...

*--Serdar

Read only

0 Likes
1,714

Thanks for your reply Thomas and Serdar,

I now destroy the right container and the right tree control if it exists after the event 'double_click' on a node in the left tree.

The result is now that the container is created (I can see it on screen) but no tree is shown.

If I just destroy the tree control but not the container the tree from the first double click on the left tree is shown.

In the debugger I see that the list tree instance is linked to the caontainer (after first and second creation of tree control)

Maybe you can see in the coding below what's wrong or missing.

Coding after EVENT DOUBLE_CLICK in left Tree: <pre>

*----


  • destroy ‘old’ tree instance and container

if not g_container_2 is initial.

call method g_container_2->free.

clear: g_container_2, g_tree_2.

endif.

  • create right container

call method g_splitter->get_container

exporting row = 1

column = 2

receiving container = g_container_2.

  • setup the hierarchy header

hierarchy_header-heading = 'Hierarchy Header'.

hierarchy_header-width = 37.

  • create a column tree model instance

create object g_tree_2

exporting

node_selection_mode = cl_column_tree_model=>node_sel_mode_single

item_selection = 'X'

hierarchy_column_name = 'C1'

hierarchy_header = hierarchy_header.

  • create tree control

call method g_tree_2->create_tree_control

exporting

parent = g_container_2.

perform add_columns.

perform define_events.

  • set registered events

call method g_tree_2->set_registered_events

exporting

events = events.

perform get_data.

perform add_nodes_2.

  • expand the root node

call method g_tree_2->expand_node

exporting

node_key = 'Root'

level_count = 3.

*----


</pre>

Regards

Ferdi

Message was edited by: Ferdi Meyer

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,714

Hi Ferdi

Do not destroy instances just put the condition as I explained in my previous answer. That is...

<b>IF gr_right_tree IS INITIAL OR

NOT gv_refresh_right IS INITIAL .</b>

<i>*--Additional refresh condition checks may be done here

*--Here put tree building code for the right tree</i>

<b>CLEAR gv_refresh_right .

ENDIF.</b>

Will this help??? I can't foresee how instances will react. I would like to hear about the result ..

*--Serdar

Read only

0 Likes
1,714

Thanks a lot Serdar,

I got it and it's working now as explained by you.

I just had to ->delete_all_nodes before I fill nodes and items for the next right tree.

Best regards

Ferdi

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,714

Hi Ferdi

It is nice that your problem is solved. Could you please turn the status of the thread to "Solved"?

Thanks...

*--Serdar

Read only

0 Likes
1,714

Hi Serdar,

the threat is already marked as 'answered'.

Do I have to do another status setting?

Regards

Ferdi

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,713

Hi Ferdi

I am not in much deep with this but. There is an empty star next to your thread topic. As far as I know, it means your thread is not solved.

There should be something that you give points to helpful answers and also you mark one of the posts as the one that solved your problem.

This is just the new trend :). Mark the post which you think solves the problem as the solving post and give points to posts you find helpful. However, I do not know the way how to do???

*--Serdar

Read only

0 Likes
1,713

6 reward points for you Serdar .

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,713

Hi Ferdi

It was nice of you that you granted those points but my concern was just to give the consciousness about that. As told before, this is just the newest trend. Hope it goes well.

Thanks again.

*--Serdar