Keyboard maps (was foreign languages in script editor)
larsbrehmer at mac.com
Sun Sep 3 15:06:45 EDT 2006
In a message dated 9/2/06 11:39:09 AM, Lars Brehmer
<larsbrehmer at mac.com>
>> When you have fields in different languages with different keyboard
>> maps on a card, is it possible to have the keyboard map switch to the
>> correct one when you click in a field? This is driving me nuts! And
>> in both directions! When I am in one field and then click in one
>> that needs a different keyboard map, the keyboard map does not
>> change. On the other hand, sometimes when the keyboard map is set to
>> the one I want and click in another field which needs the same map,
>> my keyboard map switches to the wrong one!!!!! When I want the map
>> to change it doesn't, when it shouldn't change it does! I am out of
>> ideas on this one and would appreciate some help.
> Multiple different languages in use on different fields of one
> card? Yow!
> That's... unusual.
I guess it is pretty unusual, but not for certain language learning
stacks. In this case it is teaching Estonian vocabulary to Russians,
so the cards have fields in Estonian (Roman alphabet with 6 letters
with diacritical marks) and Russian (cyrillic alphabet). The cards
display perfectly using uniEncode and uniDecode, but some cards are
editable, so the user has to be able to type in Russian words in some
fields and Estonian words in others. It would be great if a field is
clicked in the keyboard map is adjusted accordingly. There are also
utilities, among others for searching, where the cursor is placed in
a field (select after text), so it would be terrific if when this
happens, the user doesn't have to pay attention to which keyboard map
is active and which one it should be...
> And automatically swapping to a different keyboard map at
> arbitrary times, well, that's even more so! Hmmm...
... so the switches aren't really arbitrary - some fields need one
map, some need the other.
> My first thought: Don't bother with the OS keyboard maps --
> especially if
> this project of yours is to be installed on machines that you don't
> which keyboard maps are available.
Well, I am certain that Russians using Windows can easily add the
Estonian keyboard map (which I believe is included in Windows in the
Regional and Language Options control panel, it just needs to be
added via that control panel) and I know for a fact that the Mac
users (like me, by the way) have both keyboard maps at their
disposal, so this isn't really the issue.
> Instead, build your own maps, associating each
> rawKeyDown value with a particular character, and use the maps you
> Put all your keyboard maps into custom properties of the stack;
> give each
> relevant field a custom property that defines which keyboard map to
> use. Also give
> each relevant field this script:
I appreciate the suggestion, but this is so far beyond my Rev
programming abilities that I really wouldn't know where to start :-(
I know some of you out there are making apps that have similar
language requirements, so are there any other solutions for this? If
not, I would most certainly appreciate more info (at the near idiot
level ;-) ) on the suggestion below!
> local MyKeyboard
> on focusIn
> end focusIn
> on openField
> end openField
> on GetLanguage
> put the PreferredLanguage of me into MyLang
> -- "me" is the field, right?
> put the KeyboardMap[MyLang] of this stack into MyKeyboard
> end GetLanguage
> on rawKeyDown ThisKey
> put character (ThisKey) of MyKeyboard into (the selectedChunk)
> -- assumes that a keyboard map is a string of characters, with
> -- the character for "rawKeyDown N" being the Nth character in
> the string
> end rawKeyDown
> This script is completely untested, but hopefully it will at
> least serve
> as a starting point to help you get where you want to go...
More information about the Use-livecode