Very difficult key codes!
-
hello all
First sorry for my poor English:)three days since I am fighting with the shortcut.
I want to delete the paths in the plugin camerakeymaker with the shortcut ALT + DELETEIn the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
on the PC it's available on the onkeyDow AND onkeyup.But in the pc it does not work correctly on onkeyup
onkeyup; if ((key == VK_DELETE) && ((flags & VK_ALT) == VK_ALT)) p "OnKeyDown; DELETE PATH" .... end
When I press (alt + delete) or (delete only) it pass in statement
do you can help me ???
best regard
-
@unknownuser said:
(http://forums.sketchucation.com/viewtopic.php?f)":dwixdyu1]
I haven't been able to trigger a VK_ALT on either system.
-
I was never able to catch VK_DELETE under Windows...
-
I would say that straightforward simplicity is the lowest form of elegance.
-
@macgile said:
In the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
on the PC it's available on the onkeyDow AND onkeyup.Here is what I find, under Windows:
When only
Delete
is pressed, it triggers onlyonKeyUp
.
WhenShift
+Delete
is pressed, it onlyonKeyUp
.
WhenCtrl
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
.
WhenAlt
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
. -
@thomthom said:
@macgile said:
In the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
on the PC it's available on the onkeyDow AND onkeyup.Here is what I find, under Windows:
When only
Delete
is pressed, it triggers onlyonKeyUp
.
WhenShift
+Delete
is pressed, it onlyonKeyUp
.
WhenCtrl
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
.
WhenAlt
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
.Thank's thomthom
thank you it is very useful
-
oups
fix for mac :
K_CTRL_ALT = VK_CONTROL.to_s << VK_ALT.to_s
K_ALT_DEL = VK_ALT.to_s << VK_DELETE.to_sonKeyUp
#window || mac (on mac, delete it triggers only in onKeyUp)
if(@flags == K_ALT_DEL || (@flags + key.to_s) == K_ALT_DEL))do something
end
-
hi Dan Rathbun,
first thank's to reply
i have found this solution
windows :
K_CTRL_ALT = COPY_MODIFIER_KEY.to_s << ALT_MODIFIER_KEY.to_s
K_ALT_DEL = ALT_MODIFIER_KEY.to_s << VK_DELETE.to_smac:
K_CTRL_ALT = VK_CONTROL.to_s << VK_ALT.to_s
K_ALT_DEL = VK_ALT.to_s << VK_DELETE.to_s@flags =""
CTRL + ALT or ALT + DEL
def onKeyDown(key, repeat, flags, view)
SAVE KEY to string
@flags += key.to_s
enddef onKeyUp(key, repeat, flags, view)
if (@flags == K_CTRL_ALT)
do something
end
#window or mac (on mac, delete it triggers only in onKeyUp)
if(@flags == K_ALT_DEL || (@flags + key.to_s) == K_ALT_DEL))do something
end
@flags = ""
endit's not "très élégant" but it works with any key combination
best regard
-
@thomthom said:
Here is what I find, under Windows:
When only
Delete
is pressed, it triggers onlyonKeyUp
.
WhenShift
+Delete
is pressed, it onlyonKeyUp
.
WhenCtrl
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
.
WhenAlt
+Delete
is pressed, it triggers bothonKeyDown
andonKeyUp
.I'm unable to access my mac atm. Anyone able to run this on Mac and check the results? I'm curious if VK_DELETE register on key down under OSX.
-
Also note that
TAB
on MAC only fires withonKeyUp
and is ignored otherwise !
The TAB key == 9 or 15 or 48 [for PC or MAC or ??]
Advertisement