You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by sarah <sr...@mobilelutions.com> on 2011/11/16 17:30:11 UTC

programmatically adding a textinput

I'm new at this.  Is there an example of how to add a textinput based on a
selection from a listbutton?

Can I add a textinput and set it visible/invisible as needed? 

Thanks

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/programmatically-adding-a-textinput-tp3513202p3513202.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: programmatically adding a textinput

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
I assume you would want to enable a text input based on whether an 
"Other" value is selected in the ListButton?!

The way we are doing that is something like this:
enum ListEnum {
     FIRST,
     SECOND,
     OTHER
}
listButton.setListData(new 
ListAdapter<ListEnum>(Arrays.asList(ListEnum.values())));
listButton.getListButtonSelectionListeners().add(new 
ListButtonSelectionListener.Adapter() {
     @Override
     public void selectedItemChanged(ListButton listButton, Object 
previousSelectedItem) {
         textInput.setVisible(((ListEnum)listButton.getSelectedItem()) 
== ListEnum.OTHER);
     }});

On 11/16/11 8:30 AM, sarah wrote:
> I'm new at this.  Is there an example of how to add a textinput based on a
> selection from a listbutton?
>
> Can I add a textinput and set it visible/invisible as needed?
>
> Thanks
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/programmatically-adding-a-textinput-tp3513202p3513202.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>
>