on 03-11-2008 11:58 AM
Hi, I have Textbox child and a Checkbox child with context of type boolean. I made a TextboxVISIBLE context of type Visibility and binded it to "enabling" option of Textbox. Now how can i bind it checkbox with textbox so once I mark checkbox the Textbox appears, unmarked dissapears. Regards, Balmer.
Hi Balmer,
After u create the checkbox and bind it to an attribute of type binary
create a textbox and bind the "visible" property of the textbox to an attribute of type "VISIBILITY", and in the action of the checkbox write the following piece of code:
onActionClickCheckBox()
{
-
>if(blnCheck)
-
>{
-
>wdContext.currentContextElement.setTextBoxVisibility(WDVISIBILITY.VISIBLE);
-
>}
-
>else
-
>{
-
>wdContext.currentContextElement.setTextBoxVisibility(WDVISIBILITY.NONE);
-
>}
}
Hope this helps u now
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Context:
- textVisibility (calculated attribute, type=Visibility)
- checked (boolean)
Data binding:
CheckBox.checked -> checked
CheckBox.onToggle -> Some action
TextView.visible -> textVisibility
WDVisibility getTextVisibility(IContextElement element)
{
return element.getChecked() ? WDVisibility.VISIBLE : WDVisibility.NONE;
}
The empty action is only needed if you want to update the visibility immediately on each check box toggling.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
"I have Textbox child and a Checkbox child with context of type boolean. I made a TextboxVISIBLE context of type Visibility and binded it to "enabling" option of Textbox. Now how can i bind it checkbox with textbox so once I mark checkbox the Textbox appears, unmarked dissapears"
Checkbox should have an action "onToggle" associated with it.
//Check its selected or not, change the code to align with your context attributes.
if(wdContext.currentContextElement().getSelected())
{
//Assuming the name of the context attribute that is bound to the visible property is "TextBoxVisibility"
wdContext.currentContextElement().setTextBoxVisibility(WDVisibility.VISIBLE);
}
else
{
wdContext.currentContextElement().setTextBoxVisibility(WDVisibility.NONE);
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for answers. It works other way around, once I mark checkbox the textbox dissappears (since it was visible after application starts). Changing VISIBLE and NONE options with each other in code does not work of course.
Once I add to:
public void wdDoInit()
{
//@@begin wdDoInit()
wdContext.currentContextElement().setTextBoxVisibility(WDVisibility.NONE)
//@@end
}
to make it not visible when application starts like I want it then in that case once I mark checkbox it does not respond (textbox not appeared), unmarking does not make it appeared as well. Shall I code something in Selected method? Regards, Balmer.
hai balmer,
1. create two context attributes.1 of type visible and another of type boolean
2.now set the visible property of text box to the 1st attribute of context of type visible and set the checked property of the checkbox to the context attribute of type boolean.
3.create a method and call that method in ontoggle action of checkbox
4.In the method check if the check box value is true or false(checked or unchecked)
5.If its true then set the 1st attribute to wdvisibility.visible.
Any issues in this plz let me know
Thanks n Regards
Sharanya.R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.