on 05-24-2011 6:58 AM
Hai all,
I want to enable the button once checked the check box. Am using this code,
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->Element_context.
DATA lv_check_button TYPE wd_this->Element_context-check_button.
lv_check_button = 'ABAP_TRUE'.
get element via lead selection
lo_el_context = wd_context->get_element( ).
@TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
set single attribute
lo_el_context->set_attribute(
EXPORTING
name = `CHECK_BUTTON`
value = 'lv_check_button' ).
Am getting it.
Once I uncheck the check box means the button has to be disabled. What can I do to resolve this. Pls give some suggestions.
Thanks in Advance,
Nalla.B
Hi.,
In your code ., first read the check box value. ,
if it is checked.,
lv_check_button = 'ABAP_TRUE'.
else
lv_check_button = 'ABAP_FALSE'.
endif.
then set sttribute property of button.
hope this helps u.,
reply if u need some more clarifications.,
Thanks & Regards
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hai kris,
I did the same But if i uncheck the checkbox means that button is still enabled.....
I hav bounded that check attribute to the 'checked' propertyof the checkbox UI element......
Can u pls help me where i went wrong. Tis s my coding
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->Element_context.
DATA lv_check TYPE wd_this->Element_context-check.
get element via lead selection
lo_el_context = wd_context->get_element( ).
@TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `CHECK`
IMPORTING
value = lv_check ).
"IF lv_check EQ ' X'.
"DATA lo_el_context TYPE REF TO if_wd_context_element.
" DATA ls_context TYPE wd_this->Element_context.
DATA lv_check_button TYPE wd_this->Element_context-check_button.
get element via lead selection
lo_el_context = wd_context->get_element( ).
@TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
if lv_check eq 'X'.
lv_check_button = 'ABAP_TRUE'.
else.
lv_check_button = 'ABAP_FALSE'.
endif.
set single attribute
lo_el_context->set_attribute(
EXPORTING
name = `CHECK_BUTTON`
value = 'lv_check_button' ).
Thanks in advance,
Nalla.B
Hi Nalla,
This is the code i am using it is working for me..
I created two attributes enable and check, and i bind check with checkbox checked property and enable with button enable property.
Write this code on_toggle action of check box.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->Element_context.
DATA lv_check TYPE wd_this->Element_context-check.
get element via lead selection
lo_el_context = wd_context->get_element( ).
get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `CHECK`
IMPORTING
value = lv_check ).
if lv_check = 'X'.
DATA lv_enable TYPE wd_this->Element_context-enable.
get element via lead selection
lo_el_context = wd_context->get_element( ).
set single attribute
lo_el_context->set_attribute(
name = `ENABLE`
value = ABAP_TRUE ).
else.
set single attribute
lo_el_context->set_attribute(
name = `ENABLE`
value = ABAP_FALSE ).
endif.
Cheers,
Kris.
HI ,
I would have created a new context attribute of type WDY_BOOLEAN and bound that to the enabled property of the button.
Now I would create a event handler to the 'On toggle' event of the checkbox .
The 'ontoggle' event provides a standard paramater , "checked" that holds the current state of the checkbox(01-checked, ' ' -unchecked).
Based on the value of the paramater, I would have set the value of the attribute bound to the 'enabled' property of the button.
Thanks,
Aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.