on 05-29-2008 10:00 AM
hi All,
I would like to know how to generate UI elements during runtime.
in my pgm i want to dynamically generate button.
So how can i write the code.
thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Sirisha,
for example if u want to create a button with name new
then following code works.check it and u have to write this code in wddomodifyview()
data: LR_CONTAINER type ref to CL_WD_UIELEMENT_CONTAINER,
LR_BUTTON type ref to CL_WD_BUTTON,
lr_flow_data TYPE REF TO cl_wd_flow_data.
LR_BUTTON = CL_WD_BUTTON=>NEW_BUTTON( id = 'BUTT_1' text = 'NEW' on_action = 'CLICK' ).
LR_CONTAINER ?= view->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
lr_flow_data = cl_wd_flow_data=>new_flow_data( element = lr_button ).
LR_CONTAINER->ADD_CHILD( LR_BUTTON ).
Reward points if usefull,
Regards,
Anusha
Edited by: anusha sabbineni on May 30, 2008 12:55 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
With the help of implicit variable "view" we can get the reference of container and from there you can easily add button on it.
class for button: cl_wd_button.
Remember "view" is a impoting parameter of method wddomodifyview and only available there so if you want to create a button at some where else then you must this variable. you can declare the attribute of IF_WD_VIEW type and can take the instance of "view". With this you can access "view" at any point of time except in method "wddoinitialize".
Code to take reference of "view" :
m_view type if_wd_view "this should be declared in Attribute tab of View
if first_time = 'X'. " you will get "first_time" for free in the wddomodifyview method.
wd_this->M_view = view
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
check this code to create button dynamically.
DATA: lr_ui_root TYPE REF TO if_wd_view_element.
DATA: lr_button TYPE REF TO cl_wd_button.
DATA: lr_container TYPE REF TO cl_wd_uielement_container.
CALL METHOD io_view->get_element
EXPORTING
id = 'tc1' "transparent container name
RECEIVING
element = lr_ui_root.
lr_container ?= lr_ui_root.
CALL METHOD cl_wd_button=>new_button
EXPORTING
id = 'tc1' "transparent container name
on_action = 'ADD_ROW' "action"
RECEIVING
control = lr_button.
cl_wd_matrix_head_data=>new_matrix_data(
EXPORTING
element = lr_button ).
lr_container->add_child(
EXPORTING
the_child = lr_button ).
regards
chythanya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.