[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] GUI keycode inconsistencies?



modifiers are the same. the only difference is cocoa adds a weird additional ones (i think 0x100, and 0x02 ?). so if you use them correctly, that is, you bit-or the modifiers with the pattern bitmask, it works fine cross-platform.

don't do : if( modifiers == 131330, { "Shift down!".postln })

but do : if( (modifiers & 0x00020000) != 0, { "Shift down!".postln })

etc.

ciao, -sciss-


Am 24.10.2007 um 21:54 schrieb tom tlalim:

sorry, i missed that...
so for cross-platform patches i'd better use unicode.
i now notice that modifiers get different values too.

any tips on a strategy for fully functional plug-and-play situations on all platforms?

grtz,
tom

On 10/24/07, Sciss < contact@xxxxxxxx> wrote:hi tom,

from JSCView.html : "Note: The virtual java key codes are not
translated into actual hardware key codes, thus the codes received
through Cocoa GUI are different from those received through SwingOSC.
For example, pressing '#' reports keycode 92 using SwingOSC or
keycode 42 using Cocoa. Since java virtual codes are layout
independant, there is no unique way to map them to Cocoa keycodes
which are layout dependant (e.g. the 'Y' key will have different
Cocoa keycodes on a QWERTZ and a QWERTY keyboard, while java will
always attribute the value 89 to it). That's why an attempt to map
values has not been made !!!"

sorry for inconvenience ...

Am 24.10.2007 um 19:28 schrieb tom tlalim:

> hi sciss, adc, all,
> thank you for the GUI scheme - i started using it for all my
> patches and it's excellent!
>
> one strangeness though...
> i get different keycode values in swing than in cocoa:
>
> on a macbook, OSX:
>
> a = GUI.window.new.front.view.keyDownAction_({|view, char, unicode,
> keycode| [ keycode].postln}).focus
>
> hit "a, b, c, d":
>
> GUI.swing
> 65
> 66
> 67
> 68
>
> GUi.cocoa
> 0
> 11
> 8
> 2
>
> any ideas why?
>
> regards,
> tom
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users

_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users

_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users