Re: Search in ComboBox

Martin (OPENGeoMap) wrote:
>>> What about a gtk entry with  autocompletion?
>> Hi Martin!
> Here in python a complete sample using autocompletion:
>   entry = gtk.Entry()
>   completion = gtk.EntryCompletion()
>   entry.set_completion(completion)
>   liststore = gtk.ListStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf)
>   completion.set_model(liststore)
>   pixbufcell = gtk.CellRendererPixbuf()
>   completion.pack_start(pixbufcell)
>   completion.add_attribute(pixbufcell, 'pixbuf', 1)
>   # create a gtk.CellRendererText and pack it in the completion. Also set
> the
>   # 'text' attribute
>   completion.set_text_column(0)
>   # load up the liststore with string - pixbuf data - assuming pixbuf
> created
> the same for ruby/gnome, monogtk#, gtkmm, gtk, etc,..
>   liststore.append(['string text', pixbuf])
> You need a entry and also the EntryCompletion class. The widget you can 
> see is the gtk::entry

Hi there

I'm trying to do that same thing, but using a comboboxentry, wich gets the
list from a DB.

This is my code and it gets the values from the DB and show them as a
combolist, but I have
no idea of how to add that autocomplete function to that. This is my code so

	widget = "combo_widget" # "combo widget" is a comboboxenty and I0m using
glade to create it.
	self.combo = self.xml.get_widget(widget)

	self.c.execute("SELECT column FROM table")
	list = self.c.fetchall()
	for values in list:
		self.combo.append_text('%s' % values[0])

View this message in context:
Sent from the Gtkmm mailing list archive at

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]