Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Capturing Win32 Mouse Repeat Events


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 web383   Members   -  Reputation: 787

Like
0Likes
Like

Posted 27 April 2013 - 06:53 PM

Is it possible to receive WM_LBUTTONDOWN auto repeat events similar to WM_KEYDOWN with the standard repeat delay?

 

I'm working on a GUI, and would like to mimic scrollbars and repeat buttons much like the widgets in a C# WinForms application.  I was hoping this would be possible without implementing a custom timer and handling it manually.



Sponsor:

#2 Endurion   Crossbones+   -  Reputation: 3645

Like
1Likes
Like

Posted 27 April 2013 - 11:58 PM

Can't you use WM_KEYDOWN directly with VK_LBUTTON and it's siblings?


Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

#3 web383   Members   -  Reputation: 787

Like
0Likes
Like

Posted 28 April 2013 - 01:23 AM

I did try that, and my mouse clicks don't seem to be triggering a WM_KEYDOWN message.  Should they be?  Or can VK_LBUTTON only be queried through GetKeyState() and GetAsyncKeyState()?



#4 Amr0   Members   -  Reputation: 1130

Like
1Likes
Like

Posted 28 April 2013 - 02:01 AM

Windows will only send a single message when a mouse button is pressed and held, but it will send multiple (repeat) WM_KEYDOWN messages when a key on the keyboard is pressed and held. So yes, your scrollbar widget will have to use timers (or some other mechanism for performing an action with a certain frequency) to mimic the standard scrollbar behavior. But using Windows' timers is not difficult at all, so I don't see why you would want to avoid them.



#5 web383   Members   -  Reputation: 787

Like
0Likes
Like

Posted 28 April 2013 - 10:00 AM

Thanks for the replies.  This is exactly the behavior I've encountered.  Using a timer isn't an issue at all, I was mostly curious if it was possible otherwise.

 

I'm also using SystemParametersInfo() with SPI_GETKEYBOARDDELAY and SPI_GETKEYBOARDSPEED to query the initial delay and repeat speeds of the keyboard settings, and just applying it to a custom mouse-down repeat event.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS