RE: incompatible pointer type?



Hi Shane. Probably the list variable should be cast to GTK_CLIST (list), though you don't show where it is defined.

Casting is something you'll be doing a lot in gtk. The way to tell if it is necessary is to look at the api for a call. For instance look at gtk_clist_new. It returns a *GtkWidget. Now look at gtk_clist_set_text. The api states that the first argument is of type *GtkClist. That means that you need to cast the *GtkWidget variable returned from gtk_clist_new to a *GtkClist variable. The way to do that is through the macro GTK_CLIST. The macros are pretty consistent - to cast to GtkEditable use GTK_EDITABLE, to cast to GtkLable use GTK_LABEL etc. The macros are defined in the header files or the api reference should indicate what is the necesarry macro.

Hope that helps,
Kevin


From: "Clancy, Shane W." <SCLANCY northropgrumman com>
To: 'Jens Askengren ' <jensus linux nu>
CC: "'gnome-devel-list gnome org '" <gnome-devel-list gnome org>
Subject: RE: incompatible pointer type?
Date: Tue, 12 Mar 2002 06:55:30 -0800


Jens,
Thank you.  The code now compiles.  It doesn't work, but it compiles.

A few additional questions if you don't mind.  Where would I look for more
information on macros (what they do, what macros are offered for gtk/gnome,
etc)?  When i click on the apply button, the following shows up on the
terminal window i kicked the app off from:

Gtk-CRITICAL **: file gtkclist.c: line 2229 (gtk_clist_set_text): assertion
`GTK_IS_CLIST (clist)' failed.

Any thoughts?

Thank you again.

Shane

-----Original Message-----
From: Jens Askengren
To: Clancy, Shane W.
Cc: gnome-devel-list gnome org
Sent: 3/12/02 9:30 AM
Subject: Re: incompatible pointer type?

tis 2002-03-12 klockan 14.50 skrev Clancy, Shane W.:

> here is the offending function:
>
> void
> on_apply_button_clicked                (GtkButton       *button,
>                                         gpointer         user_data)
> {
> 	gchar 	text[2];
> 	gint	  i;
>
	/* Use the GTK_EDITABLE-macro here:
> 	 text[0] = gtk_editable_get_chars (col1_combo, 1, -1);
> 	 text[1] = gtk_editable_get_chars (col2_combo, 1, -1);
	*/
 	 text[0] = gtk_editable_get_chars (GTK_EDITABLE(col1_combo), 1,
-1);
 	 text[1] = gtk_editable_get_chars (GTK_EDITABLE(col2_combo), 1,
-1);
>
> 	for (i = 0; i < 2; i++){
		/* the code lacks a closing ) */
> 		gtk_clist_set_text ( list, row, col, text[i];
		*/
		gtk_clist_set_text ( list, row, col, text[i]);
> 		col++;
> 		}
> 	row++;
>
> }
>


_______________________________________________
gnome-devel-list mailing list
gnome-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]