on 05-29-2008 11:04 AM
Hi
I want to change the Text of the button on clicking it. Its like Toggle Button.
Example : start/stop button
Regards
Piyush Deora
Hi,
Approach 1:
You can do it by binding an attribute to the "text" prpperty of the button,
at run time just get the attribute and accordingly set the attribute value. Depending on the attribute value your button text will be changed.
Approach 2:
With the help of implicit variable "view" we can get the button by passing the button "ID".
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.
I would prefer Approach 1.
Hope it will help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can use the methods of class CL_WD_TOGGLE_BUTTON inside modify view and can change the text dynamically.
Regards
Sarath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
u can create an attribute of type string. and bind it to the text property of the toggle button.
lv_initial is the flag to check if the method is triggered for the first time or not.
when it is triggered for first time u set the text as start and when it is triggered for second time u give the text as stop.
when u click on the button. in action handler method u can code like this.
data lv_initial type boolean.
if lv_initial = ' '.
lo_el_element->set_attribute
exporting
name = 'button' "name of the attribute bound with text property
value = 'Start'.
lv_initial = 'X'.
endif.
if lv_initial = 'X'.
lo_el_element->set_attribute
exporting
name = 'button'
value = 'Stop'.
endif.
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 |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.