Re: Search for a widget that can completion and option_box



I had the same problem a few weeks ago. I modified a function i found in a webpage (put koders in google), this is the fuction:

/*
* This function returns a GtkComboBox with a GtkEntryCompletion inside instead a GtkEntry * it needs a GtkTreeModel containing the data and the column used to search
*/

GtkWidget *create_combo_box_entry (GtkTreeModel *model, int text_column) {
   GtkWidget *categories; /*GtkComboBox*/
   GObject *completion; /*GtkEntryCompletion*/

   categories = gtk_combo_box_entry_new_with_model (model, text_column);
   completion = G_OBJECT( gtk_entry_completion_new () );
/* There's a gtkentry inside the combobox, all we need to do is set the completion for it*/ gtk_entry_set_completion ( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( categories ) ) ), GTK_ENTRY_COMPLETION(completion) ); gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION(completion), gtk_combo_box_get_model(GTK_COMBO_BOX(categories))); gtk_entry_completion_set_text_column( GTK_ENTRY_COMPLETION(completion), text_column ); gtk_entry_completion_set_minimum_key_length (GTK_ENTRY_COMPLETION (completion), 2); gtk_entry_completion_set_inline_completion (GTK_ENTRY_COMPLETION (completion), FALSE);
   /* To keep the the widgets syncronized */
g_signal_connect( GTK_ENTRY_COMPLETION(completion), "match-selected", (GCallback) update_cb, categories ); return categories;
}

That's it, it worked for me. Oh, excuse my bad english too. :P
Matias

Edward Catmur escribió:
On Wed, 2006-08-30 at 16:36 +0200, Bernd Demian wrote:
Hi,
excuse my bad english! We are saerching for a widget that combined the
gtk_entry_completion with gtk_combo_box_entry, but we have no success. An example is the url widget in firefox. It has more than one
cell_renderer, has
completion and the possibility explicit popup the tree_view.
In all gtk extra widget sets (libsexy, libview, ..) I can't find this
entry typ. In mozilla I can't find the sources.

Have you looked at the URL widget in epiphany?

Ed

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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