I don't have an suggestions here, but will be interested to know what
you come up with. I think it is a general problem with web apps: how
to reconcile the web app's keyboard shortcuts with those of the
browser and OS. Many web apps drive me nuts because they usurp my
OS's editor shortcuts, when I am in the middle of an input field in a
form! There is no way, I want some app shortcut happening when I am
just editing text.
I've always thought that Macrobe made a mistake equating the Mac
Command key with the Windows Control key. I can see the motivation --
cut/copy/paste -- but I think the Command key is a lot more like the
Windows key than the Control key. It's too bad that both OS's
couldn't agree on a modifier key to reserve for non-OS shortcuts
(where OS includes the bundled browser).
And don't get me started on the typical Windows app, each of which
seems to invent it's own set of UI shortcuts to ensure that your
muscle memory will never be of any use...
On 2009-02-25, at 12:01EST, Brendan Fagan wrote:
I've got an application with command keys that work ok in Windows,
but don't
work in OS X. I've dug into the issue a bit to consider what to do
about
it. Here are my findings.
In order not to piss off browsers on Windows, I tend to use
shortcuts like
Control-Shift-X. Alt keystrokes tend to hit menus, while many
Control key
combinations tend to be editor functions.
On OS X, the Command key is the basic control key. It sends '17' as
does
the Control key on Windows. Since the browsers look to this key for
application shortcuts, Command is out.
In FF3 on OS X, the Control key sends '17' when pressed, the Alt key
sends
'18'. In Safari, neither the Control key nor the Alt key send any key
stroke to Flash.
In both FF3 and Safari on OS X, a combination of Control or Alt and
any
typical key (letters, numbers) send a single distinct keystroke. In
this
case, Control-X is '24', Alt-X is '188'.
I can certainly tell an OL app when it starts, what env it is
running in.
This should allow me to switch the keys via a state or something.
The question is how do I handle this with the lz.KeysService? I
could write
a handler that tracks all onkeyup events and looks for specific key
codes
such as '24' or '188', but there's already a handler that tracks all
keys in
lz.KeysService for this purpose. I propose that a callOnKeyCode()
and removeKeyCodeCall()
to allow a delegate to be bound to a specific key value.
I'd considered that you could check if a value sent to
callOnKeyCombo() is a
strring or an integer, but that would seem buggy when using it from
the
command tag. A 'keycode' attribute could be added to the command
tag that
overrides the 'key' array of strings.