keyboard maps (was foreign language in script editor)
    Cubist at aol.com 
    Cubist at aol.com
       
    Sat Sep  2 18:03:24 EDT 2006
    
    
  
In a message dated 9/2/06 11:39:09 AM, Lars Brehmer <larsbrehmer at mac.com> 
writes:
>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. And automatically swapping to a different keyboard map at 
arbitrary times, well, that's even more so! Hmmm...
   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 *know* 
which keyboard maps are available. Instead, build your own maps, associating each 
rawKeyDown value with a particular character, and use the maps you created. 
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:
local MyKeyboard
on focusIn
  GetLanguage
end focusIn
on openField
  GetLanguage
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...
-- 
ANTHRO -- http://anthrozine.com
"It's furry. It's the *good* stuff."
    
    
More information about the use-livecode
mailing list