Re: GtkComboBoxEntry Vs GtkComboBox
- From: "Peter E Dennis" <peter edwin dennis gmail com>
- To: "Claudio Saavedra" <csaavedra alumnos utalca cl>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkComboBoxEntry Vs GtkComboBox
- Date: Wed, 23 Jan 2008 10:03:12 +1100
Thanks again Claudio for taking the time to explain that to me. Much
appreciated.
On 23/01/2008, Claudio Saavedra <csaavedra alumnos utalca cl> wrote:
El mié, 23-01-2008 a las 06:09 +1100, Peter E Dennis escribió:
Thanks Claudio.
I'm just wondering why do I use the GTK_COMBO_BOX macro and not the
GTK_COMBO_BOX_ENTRY macro?
Because gtk_combo_box_append_text () is a function that works on
GtkComboBox objects, not GtkComboBoxEntry ones.
As GtkComboBoxEntry inherites from GtkComboBox, you can use functions
from the parent class in your GtkComboBoxEntry instance, but you need to
cast it, given that C can't do it itself. A little pain of using GObject
and C :-)
Claudio
Many thanks,
Peter.
On 23/01/2008, Claudio Saavedra <csaavedra alumnos utalca cl> wrote:
El mar, 22-01-2008 a las 21:55 +1100, Peter E Dennis escribió:
So I wondered if I needed to cast my GtkComboBoxEntry to a GtkComboBox
but wasn't sure how to do this so I tried:
gtk_combo_box_append_text(GTK_COMBO(cboVocSource), "Hello World");
This however makes matters worse as I get the above warning still when
I compile it, but now when I run it I get:
$ ./box
(box:11338): GLib-GObject-WARNING **: invalid cast from
`GtkComboBoxEntry' to `GtkCombo'
Can someone please tell me what I'm doing wrong?
You need to cast to a GtkComboBox, not to a GtkCombo. Use the
GTK_COMBO_BOX macro.
Claudio
--
Claudio Saavedra <csaavedra alumnos utalca cl>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Claudio Saavedra <csaavedra alumnos utalca cl>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]