cancel
Showing results for 
Search instead for 
Did you mean: 

Create transparent_container dynamically?

Former Member
0 Kudos

Hi,

how is it possible to create a transparent_container dynamically? If i try the following piece of code i get always an error message in Browser like: Access 'NULL' Objectreference not possible.



Data: 
   lr_grp_box    TYPE REF TO cl_wd_group,
   lr_transCont  TYPE REF TO cl_wd_transparent_container.

    lr_grp_box ?= view->get_element(  'GRP_Box' ).

    lr_transCont = cl_wd_transparent_container=>new_transparent_container(
        id = 'X'  view = view ).

    lr_grp_box->add_child( lr_transCont ).

regards,

Sharam

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member205703
Participant
0 Kudos

Hi Sharam,

Try to do in this way.

Data:

lr_grp_box TYPE REF TO cl_wd_group,

lr_transCont TYPE REF TO cl_wd_transparent_container.

lr_grp_box ?= view->get_element( 'GRP_BOX' ).

***no need of view its optional parameter

lr_transCont = cl_wd_transparent_container=>new_transparent_container(

id = 'X' ).

***<u>after this according to layout of the group do following , like if layout is matrix</u>

<b>cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_transCont ).</b>

lr_grp_box->add_child( lr_transCont ).

Regard's

Amol.

Former Member
0 Kudos

I think you are getting the error because of having mised case in GRP_Box. Change it to upper case GRP_BOX and it should work, provided you have a group by that name.

Regards,

Nithya

Former Member
0 Kudos

Hey...

It actually works even if you have lower case characters.

Regards,

Neha

Former Member
0 Kudos

Hello!

You need to make sure that you have a Group UI element in your Layout with the name GRP_BOX.

Regards,

Neha

Former Member
0 Kudos

Hi Neha,

i have the following UI structure on my view:

The following UI hierarchy is just added to my view by design time.

->ROOTUIELEMENTCONTAINER->Tabstrip->Tab1->Transparent_Container->GroupBox

Now i want to add a new transparent_container into my GroupBox by runtime. How can i do that?


DATA: lr_ui_root           TYPE REF TO cl_wd_transparent_container,
           lr_tab_strip        TYPE REF TO cl_wd_tabstrip,
           lr_tab                TYPE REF TO cl_wd_tab,
           lr_container       TYPE REF TO cl_wd_transparent_container.

           lr_ui_root ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
           lr_tab_strip ?= lr_ui_root->get_child( id = 'TABSTRIP' ).

           What is the next step? 

regards,

Sharam

karsten_heth
Active Participant
0 Kudos

Hi Sharam,

the only possibility to add a UI element during runtime is in method wddomodify() of the view. Only here you have access to the instance of the view (the method has a parameter "VIEW")

As Amol mentioned above, you have to get the instance of the element where you want to add the transparent container:


  DATA lr_group TYPE REF TO cl_wd_group.
  lr_group ?= view->get_element( 'GROUPBOX' ).

Then you have to create the element you wish to add and call the method add_child of lr_group.

Regards,

Karsten

sanju_joseph
Participant
0 Kudos

Hello All,

This is the old thread but still i feel that somebody can take help by looking in this thread , I faced same issue and after some analysis i found that

in order to display a textview or label , may be some more elements, you need to define layout where this textview or label can be displayed ,below

code may help in resolving this issue .

Data:lr_horizontal type ref to CL_WD_HORIZONTAL_GUTTER,

lr_grid_data type ref to cl_wd_grid_data , "Grid layout

lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_textview1 ). "assign text view to grid layout

lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_horizontal ).

lr_trans_cont->add_child( lr_textview1 ) .

Regards,

Sanju