Platforms to show: All Mac Windows Linux Cross-Platform

Back to TextInputSourceMBS class.

TextInputSourceMBS.BundleID as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The reverse DNS BundleID associated with the input source.
Example
MsgBox TextInputSourceMBS.CurrentKeyboardInputSource.BundleID

TextInputSourceMBS.Category as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The category of this input source.
Example
MsgBox TextInputSourceMBS.CurrentKeyboardInputSource.Category

Can be kTISCategoryKeyboardInputSource, kTISCategoryPaletteInputSource, and kTISCategoryInkInputSource.

TextInputSourceMBS.Deselect

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Deselects the specified input source.

inputSource: The input source you want to deselect.

Lasterror is set.

Deselect is for use with palette or ink input sources only. It has no effect on other input sources. When palette input sources are disabled, the palette disappears. Ink input sources are usually deselected and disabled at the same time.

TextInputSourceMBS.Disable

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Disables the specified input source.

Sets lasterror. Lasterror is paramErr (-50) if the input source cannot be disabled. Otherwise, lasterror is noErr (0).

Disable is primarily intended for input methods, or for applications that supply their own input sources (for example, applications that provide keyboard layouts or palette input methods, and keyboard input methods that provide their own keyboard layouts and input modes). It makes the specified input source unavailable for selection and removes it from the user interface.

TextInputSourceMBS.Enable

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Enables the specified input source.

Lasterror is set. Lasterror is paramErr (-50) if the input source cannot be enabled. Otherwise, it is noErr (0).

Enable is primarily for input methods or for applications that supply their own input sources (for example, applications that provide keyboard layouts or palette input methods, and keyboard input methods that provide their own keyboard layouts and input modes). It makes the specified input source available in the user interface for selection.

For Enable to succeed, the input source must be capable of being enabled (that is, kTISPropertyInputSourceIsEnableCapable is set to true). Furthermore, if the input source is an input mode, its parent must already be enabled for the mode to become enabled.

TextInputSourceMBS.Icon as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Queries IconMBS object for this input source.

Icon references are the typical icon format for keyboard layouts and input methods. If an icon reference is not available for the specified input source, the value is nil.

TextInputSourceMBS.IconImageFile as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The file containing the image (typically TIFF) to be used as the input source icon.

If an image file URL is not available for the specified input source, the value is nil. Note that other image formats (for example, JPEG, PNG) may also be used in the future.

Some examples using this method:

TextInputSourceMBS.IconImageURL as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The URL to the file containing the image (typically TIFF) to be used as the input source icon.

If an image file URL is not available for the specified input source, the value is nil. Note that other image formats (for example, JPEG, PNG) may also be used in the future.

TextInputSourceMBS.InputModeID as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
A reverse DNS string that identifies a particular usage class for input modes.
Example
MsgBox TextInputSourceMBS.CurrentKeyboardInputSource.InputModeID

For example, com.apple.inputmethod.Japanese.Katakana identifies a standard Katakana-input usage class that may be associated with input modes from several different input methods.
You can attach this input mode to a TSMDocument using the TSMSetDocumentProperty function with the tag kTSMDocumentInputModePropertyTag, to control the input mode usage class that should be used with that TSM document.

TextInputSourceMBS.IsASCIICapable as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the input source is intended to be capable of ASCII input.

TextInputSourceMBS.IsEnableCapable as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the input source can ever be programmatically enabled using Enable.

You can enable most input sources programmatically at any time. IsEnableCapable is set to true for these input sources.
Some input sources can never be programmatically enabled. These are mainly input method private keyboard layouts used by the input method via the function SetInputMethodKeyboardLayoutOverride. You cannot directly enable these layouts, nor use them as keyboard layout input sources. IsEnableCapable is set to false for these.
Some input sources can be programmatically enabled only under the correct conditions. These are mainly input modes, which can be changed from disabled to enabled only if their parent input method is enabled. However, they can already be in the enabled state, but not currently selectable if their parent input method is disabled. IsEnableCapable is true for these.

TextInputSourceMBS.IsEnabled as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the input source is currently enabled.
Example
MsgBox str(TextInputSourceMBS.CurrentKeyboardInputSource.IsEnabled)

TextInputSourceMBS.IsSelectCapable as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the input source can ever be programmatically selected using Select.

This static property of an input source does not depend on any current state. For input sources that can be programmatically selected if they are enabled, IsSelectCapable is set to true.
For input sources that can never be programmatically selected even if they are enabled, IsSelectCapable is set to false. Such sources are mainly input methods that have modes (parent input methods); only their modes can be selected.
For input sources that are enabled and can only be programmatically selected under the correct conditions, IsSelectCapable is set to true. Such input sources are mainly input modes, which can only be selected if both they and their parent input method are enabled.
For input sources that can never be enabled or selected, IsSelectCapable is set to false.

TextInputSourceMBS.IsSelected as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the input source is currently selected.
Example
MsgBox str(TextInputSourceMBS.CurrentKeyboardInputSource.IsSelected)

TextInputSourceMBS.LocalizedName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The input source's localized name as intended for user interface use.
Example
MsgBox TextInputSourceMBS.CurrentKeyboardInputSource.LocalizedName

Uses the best match (determined by CFBundle) between the localization used by the caller and the available localizations of the input source name. In some cases, this might be an unlocalized name.

TextInputSourceMBS.PropertyValue(key as string) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Gets the value of a specified property for a specified input source.
Example
dim t as TextInputSourceMBS
t = TextInputSourceMBS.CurrentKeyboardInputSource
MsgBox t.PropertyValue(t.kTISPropertyLocalizedName)

Key: The property key constant specifying the desired property value.

Returns a variant associated with the property key. The value type is specified for each key. Can be a string a boolean, a number, an array or an IconMBS. The function might return nil if the specified property is missing or invalid for the specified input source.

TextInputSourceMBS.SelectIt

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Selects the specified input source.
Example
// show keyboard viewer
Dim d As New Dictionary
d.Value(TextInputSourceMBS.kTISPropertyInputSourceID) = "com.apple.KeyboardViewer"

Dim sources() As TextInputSourceMBS = TextInputSourceMBS.CreateInputSourceList(d, False)
If UBound(Sources) >= 0 Then
sources(0).SelectIt
End If

Lasterror is set. Lasterror is paramErr (-50) if the input source is not selectable. Otherwise, it is noErr (0).

When the input source is a selectable keyboard, the specified input source becomes the new current keyboard input source, and the previous input source is deselected. When the input source is a palette, that palette is displayed and made available for input. Ink input sources are typically enabled and selected at the same time. When you call SelectInputSource for a palette or ink input source, there is no effect on other input sources. When you call SelectInputSource for an already selected input source, there is, similarly, no effect.

For SelectInputSource to succeed, the input source must be selectable (that is, kTISPropertyInputSourceIsSelectCapable is set to true) and the input source must be enabled (that is, kTISPropertyInputSourceIsEnabled is set to true). Furthermore, if the input source is an input mode, its parent must be enabled for it to be selected.

We named the function SelectIt as Select is a reserved word in Xojo.

TextInputSourceMBS.SetInputMethodKeyboardLayoutOverride

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the keyboard layout override for an input method or mode.

self: The input source for the keyboard layout that should be used until the current input method is deactivated (if it should be something other than the most recently used ASCII-capable keyboard layout).

Lasterorr is set. Value is paramErr (-50) if the current keyboard input source is not an input method or mode or if keyboardLayout does not designate a keyboard layout. Otherwise, it is noErr (0).

When an input method or mode is the selected input source, the most recently used ASCII-capable keyboard layout to translate key events is used. This keyboard layout is also the one that appears in Keyboard Viewer. An input source for this keyboard layout is returned by the function CurrentASCIICapableKeyboardLayoutInputSource. If a different keyboard layout should be used for a particular input method or mode, the activated input method or mode should call SetInputMethodKeyboardLayoutOverride to specify the desired keyboard layout.

For example, when a Kotoeri user selects kana layout for kana input, Kotoeri should call SetInputMethodKeyboardLayoutOverride to set the kana keyboard as the override for the appropriate input modes.

The keyboard layout set in this way is used for the final stage of key translation in the Window Server, the connection, or application-specific key translation.

The override setting is lost when the input method that set it is deactivated.

The keyboard layout used for overriding need not be enabled or explicitly selectable. It can be a non-selectable layout included in an input method bundle and automatically registered.

The default behavior is new with OS X v10.5, and eliminates the necessity that input methods have a user interface for setting the ASCII- capable keyboard for phonetic input based on Latin characters.

TextInputSourceMBS.SourceID as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The unique reverse DNS name associated with the input source.

  • For keyboard input methods and for palette or ink input sources, typically, the bundle ID, for instance, com.apple.Kotoeri.
  • For keyboard input modes, typically, the bundle ID of the parent input method plus a suffix that uniquely identifies the input mode, for instance, com.apple.Kotoeri.Katakana. It is not the generic input mode name used across input methods, for instance, com.apple.inputmethod.Japanese.Katakana.
  • For keyboard layouts, a new identification mechanism typically structured as com.company.keyboardlayout.name,for instance, com.apple.keyboardlayout.US.

TextInputSourceMBS.SourceLanguages as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The array of string, where each string is the language code for a language that can be input using the input source.

Languages codes are in the same BCP 47 form returned by the CFLocaleCreateCanonicalLanguageIdentifierFromString function. The first language code in the array is the language the input source is intended for. If no such language exists (for example, for the Unicode Hex Input keyboard layout), the first language code is an empty string.

Some examples using this method:

TextInputSourceMBS.Type as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Mac MBS MacOSX Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the type of an input source.
Example
MsgBox TextInputSourceMBS.CurrentKeyboardInputSource.Type

Value can be kTISTypeKeyboardLayout, kTISTypeKeyboardInputMethodWithoutModes, kTISTypeKeyboardInputMethodModeEnabled, kTISTypeKeyboardInputMode, kTISTypeCharacterPalette, kTISTypeKeyboardViewer, and kTISTypeInk.

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...