Subject: Fwd: GTK2 error
From: Kósa Márton <kosamster@gmail.com>
Date: Sat, 6 Feb 2010 AD 17:49:30 -0500

---------- Forwarded message ----------
From: Kósa Márton 
Date: 2010/2/6
Subject: GTK2 error
To: pike@roxen.com


Hi Pike!

I am new both to Pike and to GTK. Well, my problem is more GTK related. Here
is an excerpt from my program.

int main()
{
  GTK2.gtk_init(({"qwertzuiop"}));
  object w = GTK2.Window(GTK2.WINDOW_TOPLEVEL);
  GTK2.Widget a = GTK2.DrawingArea();
  w->signal_connect("destroy", lambda() { exit(0); } );
  GTK2.Vbox box = GTK2.Vbox(0, 0);
  box->add(a);
  w->add(box);
  a->set_events(GTK2.GDK_BUTTON_PRESS_MASK|GTK2.GDK_BUTTON_RELEASE_MASK);
  a->signal_connect("button_press_event",button_press_event);
  a->signal_connect("button_release_event",button_release_event);
  object g1 = GTK2.GdkGC(a); // (**)
  w->show_all();
  GTK2.main();
  return -1;
}

I get a message

(qwertzuiop:28705): Gdk-CRITICAL **: gdk_gc_new: assertion `drawable !=
NULL' failed

for the line marked by (**). I want to draw to the DrawingArea 'a', so I
need a GdkGC. But the system does not seem to allow to create one. Can you
explain my error?
Cheers. -sam-


---------- Forwarded message ----------
From: Kósa Márton <kosamster@gmail.com>
Date: 2010/2/6
Subject: GTK2 error
To: pike@roxen.com


Hi Pike!

I am new both to Pike and to GTK. Well, my problem is more GTK related. Here is an excerpt from my program.

int main()
{
  GTK2.gtk_init(({"qwertzuiop"}));
  object w = GTK2.Window(GTK2.WINDOW_TOPLEVEL);
  GTK2.Widget a = GTK2.DrawingArea();
  w->signal_connect("destroy", lambda() { exit(0); } );
  GTK2.Vbox box = GTK2.Vbox(0, 0);
  box->add(a);
  w->add(box);
  a->set_events(GTK2.GDK_BUTTON_PRESS_MASK|GTK2.GDK_BUTTON_RELEASE_MASK);
  a->signal_connect("button_press_event",button_press_event);
  a->signal_connect("button_release_event",button_release_event);
  object g1 = GTK2.GdkGC(a); // (**)
  w->show_all();
  GTK2.main();
  return -1;
}

I get a message

(qwertzuiop:28705): Gdk-CRITICAL **: gdk_gc_new: assertion `drawable != NULL' failed

for the line marked by (**). I want to draw to the DrawingArea 'a', so I need a GdkGC. But the system does not seem to allow to create one. Can you explain my error?
Cheers. -sam-


Return to results