RE: Indicating selected region on pixmap



Thanks for the advice, I'll code that up today,
As you may have guessed I do have a few more questions though...

In that case would I then redraw the drawing area with the pixmap everytime
the rectangle changes and then draw the new rectangle on top of that (say
while the user is dragging a new rectangle)?  While I'm at it do you (or
anyone else of course) have any suggestions for dealing with the mouse
movement event?  I've heard it mentioned in many places that you can
overwhelm a client with events if you use the motion event...  On the same
tack at this time I have a status box which shows the x and y position of
the mouse relative to the image as well as the intensity at that location.
I have this updating based on button up/down events only, for the same
motion event concerns.  Can motion monitoring be done in a reasonable
manner?  If not does this issue more effect the client, server or none of
the above?

On another note I've been searching around for the famed GTK+ and GDK
manuals in postscript and have thus far been unsuccessful, any links?

-----Original Message-----
From: Havoc Pennington [mailto:hp redhat com]
Sent: Wednesday, June 13, 2001 5:58 PM
To: Keith McDade
Cc: Gtk-App-Devel-List (E-mail)
Subject: 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]