info(“buttonrectangle”)

The info(“buttonrectangle”) function returns a rectangle defining the edges of the most recently clicked button.


Description

This function returns a rectangle defining the edges of the most recently clicked button object. Of course this function should only be used in a procedure that is triggered by a button (or any other form object that triggers a procedure). The rectangle is in screen relative coordinates (use the xytoxy( function to convert to window or form relative coordinates).

Here’s a rather silly example that times how long it takes the user to move the mouse away from a button.

local startTime
startTime=now()
loop
   nop
while inrectangle( info("mouse"),info("buttonrectangle"))
message pattern( now()-startTime,"# second~")

As long as the mouse is over the button, the procedure will whirl around and around doing nothing (remember, the nop statement does no operation). When the mouse moves away from the button, the inrectangle( function goes false and the loop is broken.

Note: This function returns the dimensions of the entire object, even if the visible portion of the button does not extend to the edges of the object.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0