Moving a Line [message #20421] |
Thu, 15 June 2000 00:00 |
Mark Guagenti
Messages: 14 Registered: May 2000
|
Junior Member |
|
|
I need some help figuring out how to copy a line drawn on the current
graphics window to another position in the same window. What should happen
is the user draws a straight line with the mouse on the current window and
then that line he drew gets moved to the lover left hand corner of the
window. What my program does right now is when the user clicks with his
left mouse button it gets the first point then waits for the user to click
the left mouse button again to get the second point. The program then uses
plots to make a straight horizontal line using the 2 x positions
found. The program SHOULD then copy that line to start at position
[5,5]. But instead the program draws a line starting at [5,5] which goes
to the x position of the current mouse position instead of the last
clicked mouse position. I attached the code I am using to try
this. Thanks for any help.
-- Mark
Grace and peace to you from God our Father and the Lord Jesus Christ.
1 Cor. 1:3
PRO CursorHelp
result = Dialog_Message('Click with your LEFT
mouse button to choose the first point. Then click your LEFT mouse button
again to choose the second point. Click the RIGHT mouse button to show
the measurement.', /INFORMATION)
Window, 2, XSize=300, YSize=300
sx = 300
sy=300
LastWin = !D.Window
Window, 1, /Pixmap, XSize =300, YSize=300
WSet, LastWin
Cursor, xx, yy, /Device, /Down
y = yy - 0
x = xx - 0
if !order ne 0 then y = sy - 1 - y ;Invert?
if (x lt 0) or (x ge sx) or (y lt 0) or (y ge
sy) then begin
result = dialog_message('Point outside
image', /INFORMATION)
return
endif
REPEAT BEGIN
Cursor, xx1, yy1, /Wait, /Device
Device, Copy=[0,0,sx,sy,0,0,1]
PlotS, [xx,xx1], [yy,yy], /Device
ENDREP UNTIL !Mouse.Button NE 1
Device, Copy=[xx,yy,xx1,yy,5,5,lastwin]
END
|
|
|