Skip to Content
avatar image
Former Member

Dynamic ACTION creation

Hi Everybody ,

I am working on dynamic creating ui ELEMENTS . iI want to create buttons dynamically in tab strip . And i dont know how many buttons i have to create also in design time .so i want to create actions also dynamically and assigneg actions to event handlers . And assignging event handlers to butoons. Pl help is there any way to achieve this . If code is there its help ful .

Thanks in advance ,

Vijay vorsu

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 09, 2009 at 08:52 AM

    Hi Vijay,

    here is a sample code.

    method WDDOMODIFYVIEW .
      data : lr_textview type ref to cl_wd_text_view.
    
    Data:lr_container type ref to cl_wd_uielement_container,
         lr_row_head type ref to cl_wd_row_head_data,
         lr_button type ref to cl_wd_button,
         lr_input type ref to cl_wd_input_field,
         lr_flow_data type ref to cl_wd_flow_data,
         lv_child_id type string.
    
    if first_time = 'X'.
    lr_button = cl_wd_button=>new_button( view = view
                                          text = 'Create Button'
                                          on_action = 'CLICK' ).
    
    lr_row_head = cl_wd_row_head_data=>new_row_head_data( element = lr_button ).
    
    lr_button->set_layout_data( lr_row_head ).
    lr_button->set_tooltip( value = 'Tooltip' ).
    lr_flow_data = cl_wd_flow_data=>new_flow_data( element = lr_button ).
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lr_container->add_child( lr_button ).
    
    lr_textview = cl_wd_text_view=>new_text_view( view = view
                                                  text = 'Welcome to Dynamic Layout Design' ).
    
    lr_row_head = cl_wd_row_head_data=>new_row_head_data( element = lr_textview ).
    lr_textview->set_layout_data( lr_row_head ).
    
    lr_flow_data = cl_wd_flow_data=>new_flow_data( element = lr_textview ).
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lr_container->add_child( lr_textview ).
    endif.
    
    endmethod.

    Kind Regards

    Sajid

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 09, 2009 at 08:51 AM

    hi,

    Dynamic ui elements should be written in wddomodifyview method.

    Regards

    Sajid

    Add comment
    10|10000 characters needed characters exceeded