Question Momentary Button

DBen

Member
Joined
Apr 9, 2010
Messages
6
Programming Experience
1-3
Is there any way to make a button on a form momentary?

I have an app where I need to have a jog button for a motor and for the life of me I can't figure out how to do this.

Best regards,

David
 
Hi John,

I probably wasn't clear enough.

I have a button on a form with the text "Jog"

The user will click and hold down this button with a mouse move a motor.

The motor should stop when the user releases the button.

Think of it as a button release event.

Best regards,

David
 
I don't understand what you mean, but click the link "Button members"/"Button Events" depending on your view, then review the list of Events available.
 
Thanks for your help John, but I don't see where it can be done.

I'll try to simplify what I'm looking for:

I have a button on a form.

When I click and hold that button down, I want textbox1 to display the text "JohnH."

When I release the button, I want to clear textbox1.

I thought I could do it with the enter and leave events, but it didn't work.

Best regards,

David
 
Try the MouseDown and MouseUp events.

EDIT: You may need to watch for the MouseDown event firing multiple times. To solve this, use a Boolean flag and set it the first time only. Clear it on MouseUp.
 
Back
Top