Mouse (simple)

Help Contents Examples Mouse (simple)
Long-dynamic-vars (text) Mousedraw (simple)

Mouse (simple)

Example:    Mouse.eli
Modified:   February 27, 2000
Version:    2.0
Author:     Pavel Boychev
E-mail:     pavel@elica.net

Copyright © 2000 Elica Group

Example for responding to mouse events.

To use the example, start it and then click somewhere on the plane, or drag the cursor over the plane

run "geomland

ob "a point 100 50 [labeled]
ob "b point 0 50 [labeled]
ob "c point 50 0 [labeled]
ob "k circle :b :a
ob "r segment :b :a
ob "n circle :a :b
ob "v ray :c :a

make "dragobject []
make "Asp 375

to onmousemove :x :y :xp :yp :s
	; s contains the button status, including control keys
	if :dragobject<>[]
	[
		make :dragobject point :Asp*:x :Asp*:y
	]
end

to onmousedown :x :y :xp :yp :s
	make "dragobject "a
	onmousemove :x :y :xp :yp :s
end

to onmouseup :x :y :xp :yp :s
	make "dragobject []
	repaint
end

Long-dynamic-vars (text) Mousedraw (simple)