Subject Re: Programmatically Adding An Event
From Tom <IHaveNoEmail@ddress>
Date Wed, 5 Dec 2018 10:37:08 -0500
Newsgroups dbase.getting-started

On 12/4/18 5:02 PM, Ronnie MacGregor wrote:
> In article <5GsYlxAjUHA.904@ip-AC1E04A7>, invalid@invalid.invald says...
>> Hold
>> the left mouse button down and the entryfield updates continuously.
> I wonder if you remember my "WhileMouseDown" functionality for
> Jean-Pierre's CD Player (dBulletin)
Issue 17 for anyone else interested ...

The WhileMouseDown Class

When the left mouse button is pushed and held down over an object, the
latter’s onLeftMouseDown() event is fired only once.  If we want an
action to be repeated while a button is pushed, we could create a loop
in its onLeftMouseDown() event and break that loop when the mouse is
released.  However, that solution is hazardous:  if the mouse is dragged
outside the surface of the button and then released over another object,
we could end up with an infinite loop.

For dBL developers, the real solution is to use a free component
designed by Romain Strieff and Ronnie MacGregor:  their WhileMouseDown
class.  This object does use a loop.  However, in that loop an API call
is made to check if the mouse button is still pushed over the button:
if it is not, the loop is broken from within the onLeftMouseDown() code,
thus preventing the hazardous situation we’ve just spoken about.

Being a visual component, this class can be made available from the
Component palette, and then can be drag’n dropped onto a form under the
Form designer.