Re: Clearing GtkComboBoxEntry
- From: Carlos Pereira <jose carlos pereira ist utl pt>
- To: Steve Harrington <steven harrington verizon net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Clearing GtkComboBoxEntry
- Date: Tue, 08 Dec 2009 15:16:07 +0000
David is right,
you should get the entry pointer with gtk_bin_get_child, and after that
you handle this entry as any other entry:
entry = gtk_bin_get_child (GTK_BIN (combo_entry));
gtk_entry_set_text (GTK_ENTRY (entry), "");
In GTK 2.0 you can also use this:
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (combo_entry)->child), "");
but this is not going to work in Gtk 3.0, as these objects will be
sealed from outside access.
In my opinion, you should forget about redundant functions such as
gtk_combo_box_get_active_text, having direct access to the entry pointer
is much better.
On Mon, Dec 07, 2009 at 07:52:02PM -0800, Steve Harrington wrote:
I have an application using GtkComboBoxEntry with a simple 2-column
int/char * ListEntry model. If the user enters data in the box (as
opposed to using a pull-down selector) I can access the index with
gtk_combo_box_get_active( GTK_COMBO_BOX(W) );
and the text with
The index is -1 as expected and the text is the text that what was entered.
The question is: How do I clear the text field when I have finished
From the FAQ and other documentation it seems that I should be able to
access the actual GtkEntry widget within the GtkComboBoxEntry widget,
get the GtkEntryBuffer, and clear it with
gtk_entry_buffer_delete_text(). None of these buffer functions/headers
are marked as depreciated but also none of them are my version of the
gtk headers (/usr/include/gtk-2.0/gtk/gtkentry.h) or anywhere else in
the gtk headers.
You can get the entry with gtk_bin_get_child(). At least that's what
the reference docs say.
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
] [Thread Prev