Re: Combo Boxes
- From: Jeroen Benckhuijsen <jfbenck home nl>
- To: Brooklyn Linux Solutions <ruben mrbrklyn com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Combo Boxes
- Date: 01 Jun 2001 00:14:22 +0200
Don't forget you're programming in C, not C++. C doesn't know anything
about inheritence of types. The inheritence in Gtk+ is created by the
library in a smart way, but the compiler doesn't recognises it off
course.
Off course you can cast entry to
GTK_WIDGET(GTK_ENTRY(GTK_COMBO(combo)->entry). However i think it's
easier just to cast it like this:
entry = GTK_COMBO(combo)->entry, becasue combo->entry is already a
GtkWidget* (look at gtk_combo.h). To use any of the functions of
GtkEntry with entry, just do: gtk_entry_...(GTK_ENTRY(entry),...)
As an alternative you can just declare entry to be a GtkEntry*. Don't
know what you want to do with it. My opinion is to declare the variable
in such a way a minimal number of casts is requiered. This is due to the
fact that each cast instruction costs some CPU time. In C++ cast
checking is done at compile time. Using Gtk, this will be done at
runtime, so it'll slow your program.
If you want to get the text in the combo, you'll probably want to
declare entry as a GtkEditable*, as you use gtk_editable_get_chars to
retrieve the text of an GtkEntry.
On 30 May 2001 22:11:05 -0400, Brooklyn Linux Solutions wrote:
I'm getting a warning on this compile on the following line:
GtkWidget * entry;
combo = gtk_combo_new();
entry = GTK_ENTRY(GTK_COMBO(combo)->entry);
combobox.c:35: warning: assignment from incompatible pointer type
I assume the GTK_ENTRY casts the wrong kind of point, although an entry is
a
GtkWidget * and so I've declared the variable entry.
Can I cast the expression: GTK_ENTRY(GTK_COMBO(combo)->entry);
like
GTK_WIDGET(GTK_ENTRY(GTK_COMBO(combo)->entry))
Ruben
--
Brooklyn Linux Solutions
http://www.mrbrklyn.com
http://www.brooklynonline.com
1-718-382-5752
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Jeroen Benckhuijsen
Software Engineer
Phoenix Software
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]