cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind the context attribute to the UI Elements Dynamically

Former Member
0 Kudos

hai,

can any body tell me that

how to bind the height and width attributes to the transparent container dynamically.

thanks and regards,

SREEVATHSAVA.G.

Accepted Solutions (0)

Answers (3)

Answers (3)

uday_gubbala2
Active Contributor
0 Kudos

Hi Sreevasthava,

I guess you intend to control the height & width of the TransparentContainer by binding the 2 properties to context attributes. If that was what you intended to ask then below is the approach you need to follow:

1) If you have created your TransparentContainer statically then you can bind the "Height" & "Width" properties of your container to 2 context attributes of type STRING. You can then specify the values for them using a simple SET_ATTRIBUTE method. Something like:

lr_node->set_attribute( exporting name = 'WIDTH'
                                  value = '200PX' ).

You would have to keep it in mind to specify any 1 of the measurement units like PX, %...

NOTE: In the above code snippet lr_node is a reference variable of type IF_WD_CONTEXT_NODE & is holding the reference of the context node under which I have my 2 HEIGHT & WIDTH attributes. You can get the reference using the GET_CHILD_NODE method...

2) If you are even creating even your TransparentContainer dynamically then at the time of instantiation you can specify the binding for the height & width properties as shown below:

lr_trans_container ?= cl_wd_transparent_container=>new_transparent_container( bind_height = 'NODE.HEIGHT'
                                                                                bind_width  = 'NODE.WIDTH' ).

NOTE: Here in the above code I am referring to 2 context attributes HEIGHT & WIDTH which I have created under a context node by name NODE. I am binding the height & width properties of my TransparentContainer to these 2 attributes. So I can now manipulate the dimensions of my TransparentContainer by doing a SET_ATTRIBUTE on the 2 context attributes.

lr_trans_container is a reference variable of type CL_WD_TRANSPARENT_CONTAINER. Once you create the container the method returns you back a reference to the newly created element. Am capturing the reference which is being returned back inside my reference variable: lr_trans_container.

Hope that this is clear for you now.

Regards,

Uday

Former Member
0 Kudos

Hi Sreevathsava,

Get your reference of your transparent container in WDDOMODIFYVIEW.

data: lo_container type ref to CL_WD_TRANSPARENT_CONTAINER.

lo_container = view->get_element( 'TCO_TEST' ).

now use the method below to bind the height attribute to container

call method lo_container->bind_height

exporting

path = 'NODE.HEIGHT'. " your naode name . attribute name

repeat the same for width too.

Former Member
0 Kudos

Hi,

Under Context,create two attributes height of type WDY_UI_ELEMENT_HEIGHT and

width of type WDY_UI_ELEMENT_WIDTH.

Bind the attibutes to the height and width property.

Now code as

  • set single attribute

lo_el->set_attribute(

EXPORTING

name = `HEIGHT`

value = '100' ).

  • set single attribute

lo_el->set_attribute(

EXPORTING

name = `WIDTH`

value = '50' ).

Thanks,

Divya.S

Former Member
0 Kudos

hai divya,

I try to display messages in pop-up, the size of the pop-up was very big,

the pop-up is generated dynamically, so to reduce size we have to bind the context dynamically.

can you suggest how to bind the attributes dynamically to the UI Element.

or please suggest how to reduce the size of the pop-up.

tanks and regards,

SREEVATHSAVA.G

Former Member
0 Kudos

hi,

chk out dis thread,

Thanks,

Divya.S