Keyboard-modified-mouse-clicks eaten by updateModifiersFromWParam ()

Hey,

I’m trying to select multiple items in a TableListBox in a plug-in on Windows 10 and haven’t had much success. “setMultipleSelectionEnabled” is set to true on the table in question, and interestingly the same project with no code alterations selects items in the table with command and shift without any problems on OS X.

Using a debugger to see where the modifier keys are set and how they react to windows mouse events, I noticed a few things:

  1. “updateModifiersFromWParam” receives a value of 5 when the mouse is clicked with shift down, and 1 when it is clicked normally, but the function itself only handles left, right, and center click, effectively ignoring the alternative value indicating a modifier.

  2. GetAsyncKeyState, and consequentially isKeyDown(VK_SHIFT), continually returns false. Poking around the MSDN, I found the following note about this function which seems to imply that it cannot be used reliably in plug-in UI?

The return value is zero for the following cases:
The current desktop is not the active desktop
The foreground thread belongs to another process and the desktop does not allow the hook or the journal record.
In other words with GetAsyncKeyState you can only monitor keyboard events that belong to your app.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/fbe9b69b-6848-4346-a393-1bfa7ea5a8e2/getasynckeystate-always-return-zero-in-window-service-in-window-7?forum=csharpgeneral

Does anyone have any suggestions about how to proceed? It seems like there’s something intrinsic to JUCE’s relationship with Win 10 specifically, and I don’t want to modify the JUCE source without a deeper understanding the potential repercussions of doing so.

It would seem that this is systemic, and probably doesn’t have much to do with the plug-in nature of my software as the Juce Widget Demo for tables also has setMultipleSelectionEnabled set to true, and multiple selections are not handled.

Hey, I’m still finding that modifier keys are broken in all juce-based apps, including the Projucer on my system. Is it possible that Microsoft deprecated some functionality in Windows 10? Reaper also has issues recognizing modifier keys.

I hate to do a “but it works on my machine” but… well… I can’t reproduce this and then it’s very hard for us to debug the problem. I’ve tried this on two computers, one with a fresh install of Windows 10 (without any updates) and one fully updated (one in a VM and one on a “real” PC). And the JUCE widget demo for tables works as expected. Is there anything special about your configuration? Any strange mouse drivers installed or a mouse utility? On what JUCE version are you?

Not to worry, thank you very much for the reply.

I recognize now this does smell of a system-specific issue that would be hard to reproduce without more information, thanks for helping look into it. Knowing that I’m the only one running into this helped. I just ran a system restore and re-installed everything, and it’s cleared things up. It’s disheartening to not be able to find where things went wrong, but relieving that it’s working.

Thank you very much for your time!