drawing_area->window!=NULL
- From: "Andrés" Giraldo <andres_giraldo yahoo com>
- To: gtk-list gnome org
- Subject: drawing_area->window!=NULL
- Date: Tue, 12 Jun 2001 11:34:49 -0700 (PDT)
Hi!
I'm trying to create a new widget, this is my init
object function:
static void gtk_newlabel_init (GtkNewLabel *newlabel)
{
GtkWidget *table;
GdkGC *gc;
table = gtk_table_new (1, 1, TRUE);
gtk_container_add (GTK_CONTAINER (newlabel),
table);
gtk_widget_show (table);
newlabel->drawing_area = gtk_drawing_area_new ();
gtk_table_attach_defaults (GTK_TABLE(table),
newlabel->drawing_area, 0, 1, 0, 1);
gtk_widget_show (newlabel->drawing_area);
gc = GetPen (NewColor (0x0000, 0x0000, 0x0000),
newlabel->drawing_area->window);
}
/*****************************************************
These functions, returns a GdkGC * color;
*****************************************************/
GdkGC *GetPen (GdkColor *c, GdkDrawable *drawable)
{
GdkGC *gc;
gc = gdk_gc_new (drawable);
gdk_gc_set_foreground (gc, c);
return (gc);
}
GdkColor *NewColor (long red, long green, long blue)
{
GdkColor *c = (GdkColor *) g_malloc (sizeof
(GdkColor));
c->red = red;
c->green = green;
c->blue = blue;
gdk_color_alloc (gdk_colormap_get_system (), c);
return (c);
}
/*****************************************************
The Widget structure
*****************************************************/
struct _GtkNewLabel
{
GtkVBox vbox;
GtkWidget *drawing_area;
};
/*****************************************************/
Why Gdk returns:
Gdk-CRITICAL **: file gdkgc.c: line 51
(gdk_gc_new_with_values): assertion `window != NULL'
failed.
Gdk-CRITICAL **: file gdkgc.c: line 456
(gdk_gc_set_foreground): assertion `gc != NULL'
failed.
It doesn't work even if I show the
newlabel->drawing_area widget or not...
Why?
Thanks!
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]