# how select area it if I go from lower left corner to top right corner - Motif

This is a discussion on how select area it if I go from lower left corner to top right corner - Motif ; How to select rectangular area by left mouse button pressed and dragged (for zoom of picture area)? I can do it if I go from top left corner to lower right corner of picture (diagonal down). I can NOT do ...

# Thread: how select area it if I go from lower left corner to top right corner

1. ## how select area it if I go from lower left corner to top right corner

How to select rectangular area by left mouse button pressed
and dragged (for zoom of picture area)?

I can do it if I go from top left corner to lower right corner of
picture (diagonal down).
I can NOT do it if I go from lower left corner to upper right
(diagonal up).
(I use XDrawRectangle() function)
Any ideas?
Valeri

2. ## Re: how select area it if I go from lower left corner to top right corner

"Valeri" wrote in message
> How to select rectangular area by left mouse button pressed
> and dragged (for zoom of picture area)?
>
> I can do it if I go from top left corner to lower right corner of
> picture (diagonal down).
> I can NOT do it if I go from lower left corner to upper right
> (diagonal up).
> (I use XDrawRectangle() function)
> Any ideas?
> Valeri
>

Simply remember for each event to check for the maximum and minimum values.
For example, when you get the first event, save (x,y). When you get the next
motion event, check to see whether the new x is greater than the saved value
or less than the saved value (same with y). When you draw the rectangle,
make sure you specify a positive value for width and height.

Also note that the width and height arguments to XDrawRectangle are
of type "unsigned int". Make sure you do the comparisons using ints,
not unsigned ints, and pass the minimum value of saved x and event->x
to XDrawRectangle, andd the same for y.

--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Aero Stability and Controls Computing