Skip to Content
avatar image
Former Member

How to bind the context attribute to the UI Elements Dynamically

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jul 23, 2009 at 06:07 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 23, 2009 at 07:23 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 23, 2009 at 07:43 AM

    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

    Add comment
    10|10000 characters needed characters exceeded