Pb w/ gc, pixmap and darea



Hello,

I'm learning gtk/gdk and i'd like to use a drawing area to draw some
lines, with a keyboard-driven interface.

Here's a part of my code :
  [...]
  darea = gtk_drawing_area_new ();
  gtk_drawing_area_size (GTK_DRAWING_AREA(darea), 800, 600);
  gtk_box_pack_start (GTK_BOX(box), darea, FALSE, FALSE, 0);
  gtk_widget_show (darea);

  darea_xpm = gdk_pixmap_new (darea->window, 800, 600, -1);
  darea_gc = gdk_gc_new (darea->window);
  [..]

I plan to connect some keyboard event to the drawing area to do some
drawing, but before doing this, i'd like at least *this* works :)

At compile time, all seems ok but at run time, i get those 2 assertions
failures :

Gdk-CRITICAL **: file gdkpixmap.c: line 62 (gdk_pixmap_new): assertion
`(window != NULL) || (depth != -1)' failed.

Gdk-CRITICAL **: file gdkgc.c: line 51 (gdk_gc_new_with_values):
assertion `window != NULL' failed.

I thought i was understanding this error message but unfortunately, i
can't find any solution. The GDK Reference tells me that gdk_pixmap_new
needs a drawable... isn't darea a drawable, here ?

Well, if someone has some pointers, or even a solution for this to
work...

thanks !

ps:
please excuse me if you think i'm not polite : i'm french and not yet
used to english speaking (writing).

-- 
Pierre-Francois Gomez
        pf gomez free fr

Abuledu, solution logicielle libre pour l'éducation :
        www.abuledu.org



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