Answered on StackOverflow (please crosslink when 
crossposting): http://stackoverflow.com/a/21956336/116472

On Saturday, February 22, 2014 12:23:15 PM UTC+1, Tom wrote:
>
> Ok, I have a need to use many ListBoxes in UiBinder.
>
> Ok, in View.ui.xml file:
>
> <g:ListBox ui:field='listBox1' visibleItemCount='3' >
>     <g:item value='1'> Car </g:item>
>     <g:item value='2'> Car2 </g:item>
>     <g:item value='3'> Car3 </g:item>
>     //more item
> </g:ListBox>
>
> <g:ListBox ui:field='listBox2' visibleItemCount='3' >
>     <g:item value='1'> Bike </g:item>
>     <g:item value='2'> Bike2 </g:item>
>     <g:item value='3'> Bike3 </g:item>
>     //more item
> </g:ListBox>
>
> // more ui binder ListBox here
>
> Now I want to setMultipleSelect for some ListBoxes only, so I can do 
> something like this <g:ListBox ui:field='listBox2' visibleItemCount='3' 
> multipleSelect="true" >, it works fine but setMultipleSelect(boolean 
> multiple) was deprecated, Google said:
>
> @Deprecated public void setMultipleSelect(boolean multiple)
>
> Deprecated. use ListBox(boolean) instead Sets whether this list allows 
> multiple selections. NOTE: The preferred way of enabling multiple 
> selections in a list box is by using the ListBox(boolean) constructor. 
> Using this method can spuriously fail on Internet Explorer 6.0.
>
> So it means we don't use setMultipleSelect but use constructor 
> ListBox(boolean) to set the MultipleSelection, so here is what I did in 
> View.java
>
> @UiField ListBox listBox1;
> @UiField ListBox listBox2;
> @UiFactory ListBox makeListBox1(){
>     listBox1=new ListBox(true);
>     return listBox1;
> }
>
> However, the above code apply ListBox(true) for all the ListBoxes 
> (listBox1, listBox2, etc). I don't want that cos some other ListBoxes need 
> to have single selection only.
>
> So why @UiFactory ListBox makeListBox1() apply for all ListBoxes & how to 
> fix it? 
>
> Not sure provided=true can help?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to