Re: Search in ComboBox
- From: Kosa <kosa piradio org>
- To: gtkmm-list gnome org
- Subject: Re: Search in ComboBox
- Date: Wed, 28 May 2008 13:49:16 -0700 (PDT)
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
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1EntryCompletion.html
>
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
far.
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])
Thanks
--
View this message in context: http://www.nabble.com/Search-in-ComboBox-tp17084508p17521300.html
Sent from the Gtkmm mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]