Cancel
Showing results for 
Search instead for 
Did you mean: 

Drag&Drop + Shift-Key

Siemens Genius Siemens Genius
Siemens Genius

Hello forum,

when using the GAwizard, there are different effects when using Drag&Drop depending on whether or not the shift-key is pressed.
I would like to use this functionality as well, but couldn't figure out how to do it. Understandably the tools/methods of the GAwizard are locked... Smiley Wink
Can anyone tell me, how these different behaviours depending on the shift (or possibly another) key can be achieved?

Thanks in advance.

Regards,
Tim 

7 REPLIES

Re: Drag&Drop + Shift-Key

Gears Phenom Gears Phenom
Gears Phenom

Hello.

 

Not herd of this feature before so did a bit of digging around.... looks like they use an undocumented function to do this which is why you cant find out anything about it.

 

getAsyncKeyState(16) >= 0

The above line is what they do to check, if it returns false then shift key is pressed, if its true then shift key is not pressed.

 

 

I am quite interested now into how this method works and how it could be programed for other keyboard buttons and what does its return value mean (i got -32768 for left shift and -32767 for right shift and 0 for everything else tested). 

 

Also interested in how many other undocumented functions there is and how we would learn about them (apart from poking our nose into code that we shouldn't...).

 

JamesM

Re: Drag&Drop + Shift-Key

Siemens Genius Siemens Genius
Siemens Genius

Hello JamesM,

thank you for your solution.

It works, even though I don't really understand how it works.

Would be interesting to get some documentation on how to check for different keys.

 

Regards,

Tim

Re: Drag&Drop + Shift-Key

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Tim,

if getAsyncKeyState(16)<0 then the shift-key is pressed.

Regards,

Peter

Re: Drag&Drop + Shift-Key

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi Tim,

 

This can be done with an undocumented function (basically, Windows). To check if the Shift-key is pressed, the following should work:

if getAsyncKeyState(16) < 0 then
--Shift is pressed
end

Use 17 for the Ctrl-key, 18 for Alt.

 


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: Drag&Drop + Shift-Key

Siemens Phenom Siemens Phenom
Siemens Phenom

This function gives you direct access to the corresponding Windows function which is documented here:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms646293(v=vs.85).aspx

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Drag&Drop + Shift-Key

Siemens Genius Siemens Genius
Siemens Genius

Thank you all for all of your answers!

Re: Drag&Drop + Shift-Key

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

Was just about to drop that link here for people. 

 

 

This one might also be interesting as it states what numbers to use for different keys, just got to convert the hex to decimal for plant sim.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

 

JamesM