You can define an "Action" procedure to be called repeatedly for as long as the button is being held down. The steps are as follows:
1. Write your "Action" procedure within an ENTERPROC...EXITPROC block. The procedure must take two parameters: a long integer (which will receive the button's "control record handle") and a short integer (which will receive the "part code" of the part of the button that the mouse is on). It should look like this:
2. Create your button.
ENTERPROC (btnH&, partCode%)
[things to do while button is down]
BUTTON _myButton, [etc., etc.]
3. Store the address of your action procedure into the contrlAction field of the button's control record.
buttonRecH& = BUTTON&(_myButton) 'Get the handle
That's all there is to it! Here's a demo:
buttonRecH&..contrlAction& = LINE "MyAction"
BUTTON 1,_activeBtn, "Click & Hold", (10,10)-(150,30)
h& = BUTTON&(1)
h&..contrlAction& = LINE "MyAction"
'(Drag away from button to see red)
IF partCode% = 0 THEN COLOR = _zRed ELSE COLOR = _zBlack
LONG IF FN TICKCOUNT MOD 20 > 10