Notifications
Clear all

[Closed] Continuous check of keyboard.shiftPressed

Title say it pretty much:

How do I get a continuous check for the state of the Shift key?
Any pointers, links, tips are appreciated.

Thanks in advance and a nice weekend to everyone

7 Replies

The only way I can think of is by using a .NET form with .KeyPreview set to true. Add an event handler for KeyDown and check the state of the shift key in your event function.

Hope this helps,
Martijn

1 Reply
(@scrimski)
Joined: 10 months ago

Posts: 0

Could you explain this a bit more? Never used dotNET before, so I’m a bit lost.
Same question for the continous polling.

Will try that, thank you.

Any other ideas?

I’m sure there’s other ways to go about this. Could you explain what you need this functionality for? Will it run in a dialog/floater?

Martijn

I’m trying to script a function to pan in 3ds Max like in PS a.k.a when the Space bar is pressed, you pan around, when released – not.

I’d suggest against continuously polling – instead, set a flag when the key is pressed, and unset it when it’s released.

Polling is bad.

1 Reply
(@magicm)
Joined: 10 months ago

Posts: 0

Agreed, but Skrimski’s question remains, how do you know when the key is pressed?