Re: Indicating selected region on pixmap



Keith McDade <kmcdade 454 com> writes:

I am doing an application where I have a gtk_pixmap inside a gtk_event_box,
all within their own parent window.  The user is supposed to select a region
by click and drag.  All that works fine but I need to draw a rectangle
indicating the selected region which should be updated until the user
releases the mouse button.  This would preferably be done without disturbing
the image underneath.  Can anyone give me a clue about how
gdk_draw_rectangle works?  Should I be using the window, the event_box or
the pixmap as the drawable?  None of the above?  Is this even a good way to
do it?  Any suggestions greatlt appreciated.


I would suggest doing this by dispensing with both GtkPixmap and
GtkEventBox, and instead using a GtkDrawingArea to draw your pixmap 
and also your other stuff onto. See "scribble" example in the tutorial
if you haven't. 

The reason I'd do this is that it's complicated and difficult to
synchronize your drawing properly with the drawing that GtkPixmap and
GtkEventBox do themselves, to avoid stepping on each other's toes.
And it's trivial to gdk_draw_pixmap() a pixmap onto a drawing area if
you're planning to do some drawing in that area anyway.

Havoc





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