Re: Search in ComboBox



It is possible, but as Murray said -- it doesn't make much sense. What would be cool finally, is if we could get the regular ComboBox dropdown act as the completion for a ComoboBoxEntry, something I wanted to be able to use for a while now.

2008/6/4 Martin (OpenGeoMap) <martin opengeomap org>:
I think it´s no possible use autocompeltation with comboboxentry.

regards.



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
  


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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