Re: Pb w/ gc, pixmap and darea



On 2001.12.12 05:12 Pierre-François Gomez wrote:
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);
  [..]

You need a gtk_widget_realize() call on the drawing area
just after you pack it:

gtk_box_pack_start (GTK_BOX(box), darea, FALSE, FALSE, 0);
gtk_widget_realize(darea);
gtk_widget_show (darea);


Now you might want to use the GDK RGB buffers if you plan to
do intensive live drawing.


--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/



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