views:

259

answers:

3

hi, i am using gwt to build my web site. i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.

please advise jaimon

A: 

You won't be able to do this with a ListBox, because it just creates an HTML < select> element.

You can use a MenuBar that has one menu with MenuItems in it to simulate a dropdown with complex widgets inside it. You will also be able to style the dropdown rather than rely on browser-styled form elements.

Jason Hall
hi thanks, can i have a listbox or listbox-like with widgets?:-)
special0ne
Yes, use MenuBar instead of ListBox and place any widget you want inside the MenuItem to simulate a ListBox. Regular ListBoxes will only allow you to specify plain text. Or use DropDownListBox in the incubator, like Mat Gessel says.
Jason Hall
+1  A: 

Take a look at the Combobox or Suggestion box in Advanced GWT Components.

Orla
A: 

Another widget is the DropDownListBox in the GWT incubator. I have not used it, but the stated intent is to provide a rich, stylable ListBox. You can pass raw HTML to the addItem() method.

DropDownListBox

Mat Gessel