Notifications
Clear all

[Closed] Start-Stop move object

I need to make a script :
when the button is pressed – starts the movement of the object,
when the button released – stops the movement

I did it with a checkbutton,
but this is a bad idea, the checkbutton must be pressed twice

with a button no way to use release button

Is there a way to do this:
pressed the button – move
released the button – stop

for movement used this:

Timer.start()
Timer.stop()

3 Replies

Use a .Net button instead:

(
	
	rollout RO_TEST ""
	(
		dotnetcontrol bt_test "Button" height:24
		
		fn GetButton args =
		(
			case args.Button of
			(
				(args.Button.Left)  : "LEFT"
				(args.Button.Right) : "RIGHT"
				(args.Button.Middle): "MIDDLE"
			)
		)
		
		on bt_test MouseDown sender args do print ("Mouse Down -> " + GetButton args)
		
		on bt_test MouseUp sender args do print ("Mouse Up -> " + GetButton args)
	)
	
	createDialog RO_TEST
	
)

for tasks like this I usually used the imgTag rollout control which has UP and DOWN button events

Great! Thanks!
This is what I need!