Mouse Pressed and Hold status


kanber

Recommended Posts

Hi,

I what catch when mouse right click and hold on pressed increase a value. 

OnLButtonDown and OnLButtonUp only work when pressed only one time. I can find long way to do it but I what to ask is there any easy way?

Link to comment
Share on other sites

So you want to do, basically, a jog? So a value is, say, incremented 10 times a second while the button is held down?  You probably don't want OnLButtonDown/Up unless you are talking about the event associated with the component.  The trick is that the events need to start and stop a sequence.  So, OnLButtonDown would just have something like:

beginseq(incrementMyVar)

and OnLButtonUp would have

endseq(incrementMyVar)

Then the sequence "incrementMyVar" would be something like:

while(1)
   myVar++
   delay(0.1)
endwhile

 

Link to comment
Share on other sites

Yes I done like that. But when I leave button it takes almost one second to show button on page like unpressed. It is like hanging. It stay like pressed position one second.

I tried to change page refresh time to 0.1 but nothing changed. I closed begin and endseq lines and test it work find.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.