Subject Re: Programmatically Adding An Event
From <> <<>>
Date Wed, 5 Dec 2018 12:14:25 -0500
Newsgroups dbase.getting-started

BTW, this does not work in PLUS 2.80
If you need it to work in PLUS 2.62/2.80 since the onMouseDown doesn't fire
unless the button is enabled, you'll have to enable the buttons in a
onGotFocus event for the entryfields.
And of course the same up and down arrows don't exist in 2.62/2.80
Otherwise it'll work the same for 2.62/2.80 as PLUS 12.

wrote in message news:C7pYvtLjUHA.1832@ip-AC1E04A7...

Instead of passing the hWnd of the button, I changed it to pass a object
That way you can test to see which entryfield has focus via a API. If
neither has focus it'll just return.
And it makes it easier to update the appropriate entryfield.
Added nMultipler in case you wanted a different jump. Changing it to 10 will
give you a jump of 10 each time.
I didn't localize any of my variables or test every combination but this
might get you started down a different road than previous test forms.

wrote in message news:wCHQ9cLjUHA.1352@ip-AC1E04A7...

I'm sorry, I posted the wrong form.
I posted one I hadn't finished.
This one is corrected to show the technique to both add and subtract.

wrote in message news:$ym54QLjUHA.1832@ip-AC1E04A7...

I took the liberty of taking the demo2b.wfm and altering it along the lines
of the WhileMouseDown functionality.
I stripped most everything out of the form and just left the controls and a
new downbutton function.
I'll leave it up to whoever want to experiment with it to add more
When either button is pushed it will add or subtract 1 to the value. If held
down it will repeat adding or subtracting 1 to the value.
The repeat speed is slowed down by using sleep so you can adjust how fast it
I pulled the routine out of one of my controls that simulates a spinbox but
I also use it to scroll though a table.

"Tom"  wrote in message news:O8yEiBLjUHA.1352@ip-AC1E04A7...

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.