Re: Search in ComboBox
- From: "Andrew E. Makeev" <andrew solvo ru>
- To: "Martin (OpenGeoMap)" <martin opengeomap org>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Search in ComboBox
- Date: Wed, 04 Jun 2008 18:27:00 +0400
You are wrong.
EntryCompletetion works perfectly well with ComboBoxEntry.
You could use same model - get it from ComboBoxEntry.
The entry is part of combo object, just call a method to get it.
cmbName = Gtk::manage( new Gtk::ComboBoxEntryText() );
for( XMLManager::VSI it = contList.begin(); it != contList.end(); ++it )
{
cmbName->append_text( Glib::locale_to_utf8( *it ) );
}
entName = ( Gtk::Entry* )cmbName->get_child();
Glib::RefPtr< Gtk::EntryCompletion > cmpName = Gtk::EntryCompletion::create();
entName->set_completion( cmpName );
cmpName->set_model( cmbName->get_model() );
cmpName->set_text_column( 0 );
В Срд, 04/06/2008 в 16:12 +0200, Martin (OpenGeoMap) пишет:
> 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]