cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

Refresh gui container

Former Member
0 Kudos

Hello,

I've just stumbled over the next annoying gui problem:

I have a top level docking container that is attached to the one and only 'application dynpro'. I'm trying to be as OO as possible here...

In that docking container I want to draw different things depending on user input.

When starting the application I draw some control into the docking container and it works just fine. But now I want to change the contents of the docking container by creating some new control that has the docking container as its parent.

Guess what - the new control doesn't show up 😐

I have even tried to destroy (clear) the docking container create it again and then construct the new control but it didn't solve the problem.

In my opinion the property of being able to change the contents of a container is crucial to any gui framework and I can't believe that sap left this functionality out.

So if anybody has an idea how to change the contents of a container at runtime I would really appreciate that.

Best regards,

Patrick Baer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick,

I have done this in the past and I'm sure that it is possible. There must be something wrong somewhere.

Instead of trying to destroy the docking container, have you tried destroying the object that you have placed in the docking container? And can you give a brief overview of what actions you are doing in what sequence to trigger what code?

Regards,

Anand Mandalika.

athavanraja
Active Contributor
0 Kudos

i too have done this and sure it works. just to make sure i just tried a sample program and it works fine.

just free the object placed into the docking container before loading another object into the docking container.

Regards

Raja

Former Member
0 Kudos

My 'architecture' doesn't allow me to free the component in the docking container at the moment. I can just say 'draw this there'. Isn't there any way to tell the container to free it's children for me ?

Best regards,

Patrick Baer

athavanraja
Active Contributor
0 Kudos

then the option is to just free the container which would free its children as well. and recreate the container and the new control on it.

Regards

Raja

Former Member
0 Kudos

Hi Patrick,

Are you saying that you do not want to free the object because you may want to display the same object in the container again later on ?

I had a similar requirement some time back when the docking container can contain the data in wither a tree format or a grid format, depending on what the user chose. Obviously, in such a case i understand that it is wasteful of processing to free the object. You will just have to de link the existing object and link the new one.

Are you also in a similar situation?

Regards,

Anand Mandalika.

Former Member
0 Kudos

Raja,

have you tried this too ?

Because that was my initial idea and it did not work in my case.

My code looks like follows:

draw_screen_frame( op_root_container = oi_root_container ).

oi_root_container->free( ).

CLEAR oi_root_container.

CREATE OBJECT oi_root_container TYPE cl_gui_docking_container EXPORTING ...

draw_screen_testcase( op_root_container = oi_root_container ).

With:

oi_root_container

a docking container as member variable,

draw_screen_frame

and

draw_screen_testcase

member functions that draw sth into the docking container.

In the gui only the output of

draw_screen_frame

is shown.

Hope this helps to find a solution.

Best regards,

Patrick Baer

Former Member
0 Kudos

Anand,

your description of my situation was quite right.

Still the main problem remains.

I will try to explain again what I want to do and what I tried so far:

<b>Situation</b>:

At the top level I have attached a docking container (DC) to the one and only dynpro in my application.

In this DC I put a 'cl_gui_container_bar_xt' (CB) on program start. The subcontainers of CB are filled as well but this should not be relevant.

At some point I want to react to a user event and display a splitting container (SC) in DC <i>replacing</i> CB. It is quite likely that CB will be displayed again later on, so complete destruction would in fact be 'wasteful'.

<b>Problem</b>:

I started off very naive by just creating CB with parent DC. This works. On user event I create SC with parent DC as well -> SC is not shown, CB is still visible.

The desired situation would be: on creation of SC with parent DC the SC should become visible CB should not be visible anymore.

<b>Tried so far</b>:

- Destruction of DC, re-creation of DC then creation of SC with parent 'new' DC. Did not work.

- Destruction of CB, creation of SC with parent DC. Did not work as well.

<b>Possible solution</b>:

Use the 'set_visible' function to dynamically make components visible or invisible - problem here: CB somehow does not have this function, though most other components do.

Once again any help is highly welcome become this problem is currently crucial to the project.

Best regards,

Patrick Baer

Former Member
0 Kudos

Hi Patrick,

I shall see to it that this problem is resolved today :-). There's just one doubt that I have got here - when you say "user event", are you referring to -

1. Application event on the CB

2. System Event on the CB

3. A Pushbutton on the Screen

Regards,

Anand Mandalika.

Former Member
0 Kudos

Anand,

I'm currently trying out another possible solution. I will post here if I succeed.

In the meantime I will answer your question:

Option 2 comes closest to the situation:

it is a system event not triggering PAI and it is raised by a custom ALV toolbar button. The ALV itself is embedded in some subcontainer of the CB.

Regards,

Patrick

Former Member
0 Kudos

Hello,

I could solve the problem.

Solution is to utilize the set_visible method of gui components. The cl_gui_container_bar_xt somehow does not provide this methods (not derived) so it had to be embedded in a cl_gui_simple_container which can be hidden and shown dynamically through the set_visible method.

Thanks to everybody who contributed to this thread !

Best regards,

Patrick Baer

Answers (0)