onMouseMove example
The following onMouseMove event handler makes a button harder to click.
function PUSHBUTTON1_onMouseMove(flags, col, row)
static jump = {|| 2 + rand( ) * 2}
local nLeft, nTop
// Calculate horizontal movement
nLeft = this.left + jump( ) * sign( rand( ) - 0.5 )
if nLeft < 0
nLeft = form.width - this.width - jump( )
elseif nLeft > form.width - this.width
nLeft = jump( )
endif
// Calculate vertical movement
if row < this.height / 2
nTop = this.top + jump( ) * row
else
nTop = this.top - jump( ) * ( this.height - row )
endif
if nTop < 0
nTop = form.height - this.height - jump( )
elseif nTop > form.height - this.height
nTop = jump( )
endif
this.move( nLeft, nTop )