You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Rachita Chandra <ra...@vmware.com> on 2011/01/27 11:30:21 UTC

Info regarding Property Binding

Hi All,

I need to enable or disable a button or textbox depending on the radio button selection.  Here is a small snippet of the bxml file


<RadioButton bxml:id="oneButton" buttonData="One" buttonGroup="$numbers" selected = "true"/>
<RadioButton bxml:id="twoButton" buttonData="Two" buttonGroup="$numbers"/>
<RadioButton bxml:id="threeButton" buttonData="Three" buttonGroup="$numbers" />

<PushButton bxml:id="selectButton" buttonData="Select"  enabled="$oneButton.selected" />

<TextInput bxml:id="textInput1"  text="${textInput2.text}" />
<TextInput bxml:id="textInput2"  text="${textInput1.text}" enabled="$oneButton.selected" />



I want the select button enabled only if the RadioButton ->oneButton is selected . If I select another radio button ,
This select button should be disabled.

I want the property binding to happen at runtime and this works absolutely fine with textboxes, both the boxes are updated
Simultaneously at runtime, but this is not the case for buttons .

Please let me know where I am going wrong.

The select button once enabled is not getting disabled even if other radio buttons are selected.


Thanks!
Rachita



Re: Info regarding Property Binding

Posted by Greg Brown <gk...@verizon.net>.
> Thanks for your reply, but (“selected” is not a notifying property)

Ah. That would be a problem then.  :-)  It probably should be a notifying property, but in the meantime, you can use a mapping function as shown in the property binding example (you can write a function that maps the checkbox state to a boolean):

http://pivot.apache.org/tutorials/property-binding.html

> I want to know 2 things
>  
> 1.       Is there any link you can provide where I can go through the properties or functions for controls like Buttons, radioButtons, checkbox etc. I looked at the source code , but I could not figure out what properties are supported for the controls

Pivot properties are just regular bean properties with getters and setters, so you can see what is supported by looking at the Javadoc:

http://pivot.apache.org/2.0/docs/api/

> 2.       In our use case, we need to have controls enabled and disabled depending on another control in the same screen.
> To give you an example, if one radio button ‘one’ is selected the Next button should be disabled, if ‘two’ is selected the Next button should be enabled and ‘back’ should be diabled.
> I need to perform similar enabling and disabling depending on checkboxes, textbox etc.

You can do this using property binding or you can do it in code by attaching listeners to the buttons directly.

G


RE: Info regarding Property Binding

Posted by Rachita Chandra <ra...@vmware.com>.
Hi Greg,

Thanks for your reply, but ("selected" is not a notifying property)

I want to know 2 things


1.       Is there any link you can provide where I can go through the properties or functions for controls like Buttons, radioButtons, checkbox etc. I looked at the source code , but I could not figure out what properties are supported for the controls

2.       In our use case, we need to have controls enabled and disabled depending on another control in the same screen.

To give you an example, if one radio button 'one' is selected the Next button should be disabled, if 'two' is selected the Next button should be enabled and 'back' should be diabled.

I need to perform similar enabling and disabling depending on checkboxes, textbox etc.

Please let me know if I can know about the properties that I will have to use to write the conditions.

Thanks,
Rachita

From: Greg Brown [mailto:gk_brown@verizon.net]
Sent: Thursday, January 27, 2011 8:40 PM
To: user@pivot.apache.org
Subject: Re: Info regarding Property Binding

Try setting:

enabled="${oneButton.selected}"

The curly braces are what creates the binding. If you don't include them, the value of "enabled" is only set when the BXML document is loaded.

G

On Jan 27, 2011, at 5:30 AM, Rachita Chandra wrote:


Hi All,

I need to enable or disable a button or textbox depending on the radio button selection.  Here is a small snippet of the bxml file


<RadioButton bxml:id="oneButton" buttonData="One" buttonGroup="$numbers" selected = "true"/>
<RadioButton bxml:id="twoButton" buttonData="Two" buttonGroup="$numbers"/>
<RadioButton bxml:id="threeButton" buttonData="Three" buttonGroup="$numbers" />

<PushButton bxml:id="selectButton" buttonData="Select"  enabled="$oneButton.selected" />

<TextInput bxml:id="textInput1"  text="${textInput2.text}" />
<TextInput bxml:id="textInput2"  text="${textInput1.text}" enabled="$oneButton.selected" />



I want the select button enabled only if the RadioButton ->oneButton is selected . If I select another radio button ,
This select button should be disabled.

I want the property binding to happen at runtime and this works absolutely fine with textboxes, both the boxes are updated
Simultaneously at runtime, but this is not the case for buttons .

Please let me know where I am going wrong.

The select button once enabled is not getting disabled even if other radio buttons are selected.


Thanks!
Rachita




Re: Info regarding Property Binding

Posted by Greg Brown <gk...@verizon.net>.
Try setting:

enabled="${oneButton.selected}"

The curly braces are what creates the binding. If you don't include them, the value of "enabled" is only set when the BXML document is loaded.

G

On Jan 27, 2011, at 5:30 AM, Rachita Chandra wrote:

> Hi All,
>  
> I need to enable or disable a button or textbox depending on the radio button selection.  Here is a small snippet of the bxml file
>  
>  
> <RadioButton bxml:id="oneButton" buttonData="One" buttonGroup="$numbers" selected = "true"/>
> <RadioButton bxml:id="twoButton" buttonData="Two" buttonGroup="$numbers"/>
> <RadioButton bxml:id="threeButton" buttonData="Three" buttonGroup="$numbers" />
>  
> <PushButton bxml:id="selectButton" buttonData="Select"  enabled="$oneButton.selected" />
>  
> <TextInput bxml:id="textInput1"  text="${textInput2.text}" />
> <TextInput bxml:id="textInput2"  text="${textInput1.text}" enabled="$oneButton.selected" />
>  
>  
>  
> I want the select button enabled only if the RadioButton ->oneButton is selected . If I select another radio button ,
> This select button should be disabled.
>  
> I want the property binding to happen at runtime and this works absolutely fine with textboxes, both the boxes are updated
> Simultaneously at runtime, but this is not the case for buttons .
>  
> Please let me know where I am going wrong.
>  
> The select button once enabled is not getting disabled even if other radio buttons are selected.
>  
>  
> Thanks!
> Rachita
>  
>