DesignImage.co.uk
 
 
summary Mouse input window control

This example creates a small window with a cross that follows the mouse as you click and drag. When I find time I will expand the face rig tools with these 2d controls as well as the spinners.


try(destroyDialog TestRoll)catch() 
    
 Rollout TestRoll "test" 
 (
 	local size = 200 
 	Label lblX 
 	Label lblY 
 	Label lblK 
 	Label lblCross "+" pos: [(size/2)-3,(size/2)-7] 
    
 	Local followMouse = false 
 	fn moveCross pos = 
 	(
 		p = [pos.x-3,pos.y-7] 
 		lblCross.pos = p 
 	)
 	fn reportXY pos = 
 	(
 		lblX.text = pos.x as string 
 		lblY.text = pos.Y as string 
 		lblk.text = if keyboard.controlPressed then "ctrl" else "" 
 		moveCross pos
 	)
 	on TestRoll lbuttondown pos do 
 	(
 		followMouse = true 
 		setSysCur #select 
 		reportXY pos 
 	)
 	on TestRoll lbuttonup pos do followMouse = false 
 	on testRoll mousemove pos do
 	(
 		if followMouse do reportXY pos 
 	)
 	on TestRoll Rbuttondown pos do 
 	(
 		followMouse = false 
    
 	)
 )
    
 createDialog TestRoll 200 200