Program Drawing a Rectangle

David Burgun dburgun at dsl.pipex.com
Wed Mar 16 12:22:08 EST 2005


Hi,

I would like to draw a rectangle specified by the mouse down/up 
position. I have a predefined Graphic Rectangle "Bounding Rect" which 
the user clicks in to draw the rectangle. The script for 
"BoundingRect" is as follows:

global gMouseRawX
global gMouseRawY

on mouseDown
put the mouseH into gMouseRawX
put the mouseV into gMouseRawY
end mouseDown

on mouseUp
put the mouseH into myMouseRawX
put the mouseV into myMouseRawY

set the style of templateGraphic to rectangle
set the left of templateGraphic gMouseRawX
set the top of templateGraphic gMouseRawY
set the right of templateGraphic myMouseRawX
set the bottom of templateGraphic myMouseRawY
create graphic

end mouseUp

This draws a rectangle ok, but it is offset from where I expect it to 
be. I obviously need to add on an offset, but not sure which offset 
to add?

Could anyone help?
Thanks in advance
Dave



More information about the use-livecode mailing list