Re: GtkComboBoxEntry Vs GtkComboBox




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]