Looks like I have found the solution. Here is the code for those who might come 
across the same problem in the future.

We need to use gtk_bin_get_childe as the GtkEntry is actually nested in the 
GtkCellRendererCombo itself.

 

Here is the code for completeness:

void testfunc(GtkCellRenderer *cell, GtkCellEditable *editable, const gchar 
*path, gpointer data){
  if (GTK_IS_ENTRY (gtk_bin_get_child(editable)))
    {
      GtkEntryCompletion *testComplete;
      GtkEntry *entry = gtk_bin_get_child(editable);

      testComplete = gtk_entry_completion_new();
      gtk_entry_completion_set_model(testComplete, GTK_TREE_MODEL(myModel) );
      gtk_entry_completion_set_text_column( testComplete, 0 );


      gtk_entry_set_completion(GTK_ENTRY(entry), 
GTK_ENTRY_COMPLETION(testComplete));
    }
}

 
> From: abx...@msn.com
> To: gtk-app-devel-list@gnome.org
> Subject: Entry completion and GtkCellRendererComboEntry
> Date: Sat, 24 Apr 2010 02:30:19 +0000
> 
> 
> Hi everyone,
> 
> 
> 
> I have an interface designed in glade that contains a treeview which contains 
> a CellRendererComboEntry. What I'd like to do is attach an entry completion 
> to it, such that one the user starts typing, a list of similiar entries in my 
> model will show up.
> 
> 
> 
> I have successfully hooked up a GtkComboEntry and an entrycompletion 
> together, however I am having some problems doing it with a 
> CellRendererComboEntry.
> 
> 
> 
> This page shows that I can use the editing-started signal of CellRenderer to 
> connect an entry completion to my CellRendererComboEntry:
> 
> http://library.gnome.org/devel/gtk/unstable/GtkCellRenderer.html
> 
> 
> 
> What I have done in Glade is:
> 
> -Under the properties of the CellRendererComboEntry:
> 
> -Model set to a model defined in glade.
> 
> -Text column : 0
> 
> -Has entry: yes
> 
> -Editable: yes
> 
> 
> 
> -Under the signal properties of the CellRendererComboEntry:
> 
> -Under GtkCellRenderer, editing-started is assign the signal "cb_testfunc"
> 
> 
> 
> This is my code for the callback:
> 
> 
> 
> void cb_testfunc (GtkCellRenderer *cell, GtkCellEditable *editable, const 
> gchar *path, gpointer data){
> if (GTK_IS_ENTRY (editable)){
> printf("It is editable");
> }else{
> 
> printf("It is NOT editable");
> 
> }
> }
> 
> 
> 
> When I run my program and attempt to edit the entry, I always get "It is NOT 
> editable".
> 
> 
> 
> Does anyone know why the it is not editable, even though I have set the 
> Editable property to yes in my CellRendererComboEntry?
> 
> 
> 
> Cheers :)
> 
> _________________________________________________________________
> Got a phone? Get Hotmail & Messenger for mobile!
> http://go.microsoft.com/?linkid=9724464
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
                                          
_________________________________________________________________
Hotmail & Messenger are available on your phone. Try now.
http://go.microsoft.com/?linkid=9724461
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to