< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The Event Manager is a legacy System 7 technology. You should use the Mac OS X Carbon Event Manager instead. See Carbon Event Manager Programming Guide.

Deprecated Event Manager Reference (Not Recommended) Functions

A function identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.5

KeyScript

Changes the keyboard script (the script system used for keyboard input), changes the keyboard layout (the mapping of keys to characters) or input method within the current keyboard script (a facility for entering 2-byte characters), or makes a setting related to text input, using the supplied value. (Deprecated in Mac OS X v10.5.)

void KeyScript (
   short code
);

Parameters
code

If 0 or positive, directly specifies a script system (that is, it is read as a script code). Negative values have special meanings.

The code parameter is a selector that can explicitly specify a keyboard script by script code. See the Script Manager for a list of script codes. If the selector specifies a script, then the current default keyboard layout ('KCHR' resource) for that script, as specified in the script’s international bundle resource, becomes the current keyboard layout.

The selector can also implicitly specify a keyboard script (for example, the next script), a keyboard layout (for example, the previously used keyboard layout in the current script), or an input method (for example, inline input versus window-based input). It can also specify settings that enable or disable keyboard layouts and keyboard scripts, and toggle among input options or line direction.

Discussion

For the purposes of KeyScript, keyboard layout means a keyboard-layout ( 'KCHR') resource, plus optionally a key-remap ( 'itlk') resource. To change keyboard layouts means to change the current keyboard-layout resource.

If the Keyboard menu is displayed, KeyScript also updates the Keyboard menu.

If you call KeyScript and explicitly specify a script system that is not available, KeyScript does nothing. The current keyboard script remains unchanged.

Note that Keyscript also does nothing when passed a positive or zero script code if the user has Font and Keyboard Synchronization turned off. You can find the Font and Synchronization checkbox under Options in the Input Menu tab of the International System Preference in Mac OS X.

Special Considerations

KeyScript operates only on those keyboard-layout and key-remap resources that are present in the System file.

Your application’s keyboard-menu setting is not maintained by the Process Manager if the state of the keyboard menu is changed while you are switched out, the Process Manager does not restore your setting when you are switched back in. However, the Process Manager does maintain the keyboard disable state (Script Manager variable smKeyDisableState) for your application. See the Script Manager for a description of the smKeyDisableState variable. KeyScript may move memory; your application should not call this function at interrupt time.

Availability
Declared In
Events.h

< Previous PageNext Page > Hide TOC


© 2003, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.