Re: GtkDrawingArea initialization



>How do I get a GtkDrawingArea to show some initial drawings when the GUI 
>starts...???  Specifically, I want a 2x2 rectangle pre-drawn at the 
>center of the DrawingArea so that when the program starts, you can 
>immediately see this center point...  The problem is, I have inserted the 
>drawing code in several places I think it would work (in a constructor -- 
>using gtkmm), but when I run my program, the rectangle does not show up... 
>Please help...

all drawing in an on-screen drawable (like your DrawingArea) in all X
Window related toolkits (including GTK) happens when handling an
expose event. in GTK, that means you have to connect to the "expose"
signal emitted by the drawing area, and draw from within the function
that handles the signal.

there are *no* exceptions to this "rule". drawing anywhere other than
in an expose handler is, at best, undefined in its effects.

--p




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