cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic ACTION creation

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

shaik_sajid
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Shaik ,

Thanks for quick reply . As i mentioned i know creating buttons .

I want 1 . How to create actions ?

2 . Assigning them to event handlers?

3. Assign action to button ?

Thanks in advance ,

Vijay vorsu .

Former Member
0 Kudos

Hi,

Action assigned dynamically can only refer to existing server side action handler method.It is not possible to define sourse code of action handler method,but it possible to define which existing action handler will be called when client side event is caught.

suppose you have created a button ..the static method new_button of class cl_wd_button is used to create button,this method allows you to assign the action using the importing parameter on_action.

Here you can mention some existing action for which action handler method is already created

shaik_sajid
Active Contributor
0 Kudos

Dear Vijay,

go through this link,You will be clear.

[|]

Regards

Sajid

Former Member
0 Kudos

Thanks

shaik_sajid
Active Contributor
0 Kudos

hi,

Dynamic ui elements should be written in wddomodifyview method.

Regards

Sajid