4 Replies Latest reply: Jul 7, 2012 4:32 AM by Shankar Gomare RSS

Passing Dynamic events to UI elements??

X MAstree
Currently Being Moderated

My scenario is given like the action name of Ui element(link to action element), image source name and position id is given in database  as shown below..based on view name

view namepositionImageAction
P11pic1.jpgCLICK
P12pic2.jpgSEND
P13pic3.jpgGEN_REPORT

 

There are 3 UI elements(LInk to action element) used in a view.Now what are they expecting me to do..Dynamically i can set the image name by binding the property of image_source to some string variable and then pass the value to string.

 

But there is nothing to bind in events...we can only create new..there is no binding available????how to do do it...??May be is it related to assistance class??

 

 

Help me out please

  • Re: Passing Dynamic events to UI elements??
    Shankar Gomare
    Currently Being Moderated

    Hi,

     

    here is code for creating link to action dynamically, properties of link to action UI element is attribute to the static method. use below code in WDDOMODIFYVIEW method.

     

       DATA lr_container    TYPE REF TO cl_wd_uielement_container.

       DATA lr_linktoaction TYPE REF TO cl_wd_link_to_action.

       DATA lr_matrix    TYPE REF TO cl_wd_matrix_head_data.

     

       IF first_time = abap_true.

         lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

     

         CALL METHOD cl_wd_link_to_action=>new_link_to_action

           EXPORTING

    *        bind_image_source          = give image source here

             on_action                   = 'CLICK' " Create action CLICK in actions tab

             text                        = 'Link'

             visible                     = '02'

           RECEIVING

             control                     = lr_linktoaction

             .

     

         lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_linktoaction ).

         lr_linktoaction->set_layout_data( lr_matrix ).

         CALL METHOD lr_container->add_child

           EXPORTING

             index     = 1

             the_child = lr_linktoaction.

     

       ENDIF.

  • Re: Passing Dynamic events to UI elements??
    X MAstree
    Currently Being Moderated

    Also if i pass text for the link to action in the method the text comes after the icon..Is it possible to display just like as shown below..text below icon and alignment of the icons is also same as this image shown below???espier-hd.jpg

  • Re: Passing Dynamic events to UI elements??
    Shankar Gomare
    Currently Being Moderated

    yes can be possible, check out attributes to method you will find option for text alignment as well. If you create dynamic UI element in view you need declare action in same controller i.e viewcontroller, create action in actions tab in view controller which will generate method in viewcontroller.