Inherits from UIView
Declared in SCWSingleCharWidget.h

Overview

Single character widget interface. @throws IllegalStateException if MyScript engine certificate has not been registered or is invalid.

Properties

autoCommitDelay

Delay in milliseconds after which auto-commit is triggered or -1 to revert to default value.
min = 100 ms
max = 10000 ms
default = 500 ms

@property (nonatomic, readwrite) double autoCommitDelay

Declared In

SCWSingleCharWidget.h

autoCommitEnabled

Enable or disable auto-commit feature.
Enable auto-commit if YES, disable if NO.

@property (nonatomic, readwrite) BOOL autoCommitEnabled

Declared In

SCWSingleCharWidget.h

autoFreezeDelay

Delay in milliseconds after which auto-freeze is triggered or -1 to revert to default value.
min = 100 ms
max = 10000 ms
default = 1500 ms

@property (nonatomic, readwrite) double autoFreezeDelay

Declared In

SCWSingleCharWidget.h

autoSpaceEnabled

Enable or disable auto-space feature.
Widget must be configured again for this setting to take effect. Note that this feature is only available for Asian languages (Chinese, Japanese and Korean) in superimposed handwriting mode.
Enable auto-space if YES, disable if NO.

@property (nonatomic, readwrite) BOOL autoSpaceEnabled

Declared In

SCWSingleCharWidget.h

characterCandidateListSize

Maximum number of character candidates.
Widget must be configured again for this setting to take effect.
Set to -1 to use the value from the .lang configuration file.
min = 1
max = 20
default = 1
initial = -1

@property (nonatomic, readwrite) NSInteger characterCandidateListSize

Declared In

SCWSingleCharWidget.h

delegate

Delegate.

@property (nonatomic, weak) id<SCWSingleCharWidgetDelegate> delegate

Declared In

SCWSingleCharWidget.h

errorCode

Error code describing the error.

No error: SCWErrorCodeNoError = 0
Invalid certificate: SCWErrorCodeInvalidCertificate = 1
Invalid API key: SCWErrorCodeInvalidAPIKey = 2
Cannot load handwriting resource: SCWErrorCodeCannotLoadHandwritingResource = 3
Cannot create user lexicon resource: SCWErrorCodeCannotCreateUserLexiconResource = 4
Cannot create subset knowledge resource: SCWErrorCodeCannotCreateSubsetKnowledgeResource = 5
Error setting internal property: SCWErrorCodeCannotSetProperty = 6

@property (nonatomic, readonly) SCWErrorCode errorCode

Declared In

SCWSingleCharWidget.h

errorString

String describing the last configuration error.

@property (nonatomic, readonly) NSString *errorString

Declared In

SCWSingleCharWidget.h

inkColor

Color of the ink.

@property (nonatomic, readwrite) UIColor *inkColor

Declared In

SCWSingleCharWidget.h

inkFadeOutDelay

Delay in milliseconds after which strokes start fading out or -1 to revert to default value.
min = 100 ms
max = 10000 ms
default = 400 ms

@property (nonatomic, readwrite) double inkFadeOutDelay

Declared In

SCWSingleCharWidget.h

inkFadeOutDuration

Duration in milliseconds of the strokes fade-out animation or -1 to revert to default value.
min = 100 ms
max = 10000 ms
default = 400 ms

@property (nonatomic, readwrite) double inkFadeOutDuration

Declared In

SCWSingleCharWidget.h

inkFadeOutEffect

Set the ink fade-out effect
Fade-out effect type or -1 to revert to default value.

@property (nonatomic, readwrite) SCWInkFadeOutEffect inkFadeOutEffect

Discussion

  • Automatic selection of fade-out effect (default mode): SCWInkFadeOutEffectAuto = 0
  • No fade-out effect on a stroke basis, all strokes are faded out on freeze event. This mode is recommended for cursive and isolated handwriting recognition: SCWInkFadeOutEffectNone = 1
  • Fade-out each individual stroke after the configured fade-out delay. This mode is recommended for superimposed handwriting recognition of latin, cyrillic and Korean scripts: SCWInkFadeOutEffectAfterDelay = 2
  • Fade-out each individual stroke by a specified amount on pen up event. This mode is recommended for superimposed handwriting recognition of Chinese and Japanese scripts: SCWInkFadeOutEffectOnPenUp = 3

Declared In

SCWSingleCharWidget.h

inkFadeOutStep

Amount of alpha faded out after each pen-up event or -1 to revert to default value.
min = 0.0f
max = 1.0f
default = 0.15f

@property (nonatomic, readwrite) CGFloat inkFadeOutStep

Declared In

SCWSingleCharWidget.h

inkFadeOutTo

Target alpha value of the strokes fade-out animation or -1 to revert to default value.
min = 0.0f
max = 1.0f
default = 0.1f

@property (nonatomic, readwrite) CGFloat inkFadeOutTo

Declared In

SCWSingleCharWidget.h

inkWidth

Width of the ink.
min = 1
max = 25
default = 7

@property (nonatomic, readwrite) CGFloat inkWidth

Declared In

SCWSingleCharWidget.h

insertIndex

Character index of the insertion point in the text.

@property (nonatomic, readwrite) NSUInteger insertIndex

Declared In

SCWSingleCharWidget.h

longPressDelay

Delay in milliseconds after which long press event is triggered or -1 to revert to default value.
min = 100 ms
max = 10000 ms
default = 500 ms

@property (nonatomic, readwrite) double longPressDelay

Declared In

SCWSingleCharWidget.h

recognitionMode

Handwriting recognition mode

  • Automatic selection of recognition mode from configured resources (default): SCWRecognitionModeAuto = 0
  • Superimposed recognition mode: SCWRecognitionModeSuperimposed = 1
  • Isolated recognition mode: SCWRecognitionModeIsolated = 2
  • Cursive recognition mode with multi-line support: SCWRecognitionModeCursive = 3
@property (nonatomic, readwrite) SCWRecognitionMode recognitionMode

Declared In

SCWSingleCharWidget.h

speedQualityCompromise

Speed/quality compromise rating.
Widget must be configured again for this setting to take effect.
Set to -1 to use the value from the .lang configuration file.
min = 0
max = 255
initial = -1

@property (nonatomic, readwrite) int speedQualityCompromise

Discussion

Higher value give better accuracy but reduce recognition speed
Lower value improve recognition speed but accuracy is lower

Declared In

SCWSingleCharWidget.h

text

Text managed by this widget.

@property (nonatomic, readwrite) NSString *text

Declared In

SCWSingleCharWidget.h

transliterationEnabled

Enable or disable transliteration feature.
Widget must be configured again for this setting to take effect.
Enable transliteration if YES, disable if NO.

@property (nonatomic, readwrite) BOOL transliterationEnabled

Declared In

SCWSingleCharWidget.h

userLexicon

User lexicon (array of user-defined words).
Widget must be configured again for this setting to take effect.

@property (nonatomic, readwrite) NSArray *userLexicon

Declared In

SCWSingleCharWidget.h

wordCandidateListSize

Maximum number of word candidates.
Widget must be configured again for this setting to take effect.
Set to -1 to use the value from the .lang configuration file.
min = 1
max = 20
default = 1
initial = -1

@property (nonatomic, readwrite) NSInteger wordCandidateListSize

Declared In

SCWSingleCharWidget.h

wordCompletionCandidateListSize

Maximum number of word completion candidates.
Widget must be configured again for this setting to take effect.
Set to -1 to use the value from the .lang configuration file.
min = 0
max = 20
default = 0
initial = -1

@property (nonatomic, readwrite) NSInteger wordCompletionCandidateListSize

Declared In

SCWSingleCharWidget.h

wordPredictionCandidateListSize

Maximum number of word prediction candidates.
Widget must be configured again for this setting to take effect.
Set to -1 to use the value from the .lang configuration file.
min = 0
max = 20
default = 0
initial = -1

@property (nonatomic, readwrite) NSInteger wordPredictionCandidateListSize

Declared In

SCWSingleCharWidget.h

Instance Methods

addSearchDir:

Add given directory to handwriting resources search path.
Directory name can point to a folder in the file system, or to a directory in a zip file. Handwriting resources can be loaded directly from the bundle folder @see configureWithBundle:andConfig:

- (void)addSearchDir:(NSString *)directoryName

Parameters

directoryName

Path to a folder containing handwriting resources.

Declared In

SCWSingleCharWidget.h

addStroke:

Add a stroke to the widget.

- (void)addStroke:(NSArray *)listCaptureInfo

Parameters

listCaptureInfo

List of capture information.

See Also

Declared In

SCWSingleCharWidget.h

characterCandidatesAtIndex:

Return alternate candidate info for the character at specified index. This method computes the character range of the character at specified index, and provides alternate candidates.

Alternate candidates can be selected by calling the replaceCharactersInRange:withText: method with parameters from the candidate information object.

- (IMCandidateInfo *)characterCandidatesAtIndex:(NSInteger)index

Parameters

index

Character index within or before the character.

Return Value

Candidate information for the character at specified index or nil if index is out of bounds.

Declared In

SCWSingleCharWidget.h

clear

Clear ink and text contained in the widget.

- (void)clear

Declared In

SCWSingleCharWidget.h

clearSearchPath

Clear handwriting resources search path.

- (void)clearSearchPath

Declared In

SCWSingleCharWidget.h

commitAndClearInk:

Commit the current writing session, optionally clear ink from the screen. This method commits the current writing session if not empty and starts a new one. If the current writing session is empty, the widget does not start a new one.

The meaning of a writing session depends on the current handwriting recognition mode.

  • In superimposed mode, a writing session represents any kind of text (from a single character up to several sentences) with each character written on top of the other. A commit operation freezes all strokes and text interpretation, keeps them and starts a new writing session.
  • In isolated mode, a writing session represents a single character. A commit operation indicates the end of the current character and starts the next one.
  • In cursive mode, a writing session is a single screen page, which represents from a single character up to several words and sentences, laid out on a single or multiple lines. A commit operation indicates the end of the current screen page and starts the next one.

Strokes currently displayed on the screen are either kept or removed from the screen based on the value of the clearInk parameter.

This method may be ignored if the widget is not configured, as the recognition mode could not be automatically detected and this information is required. If you plan on using this API before widget is configured, please consider setting the recognition mode explicitly using the provided API method.

- (void)commitAndClearInk:(BOOL)clearInk

Parameters

clearInk

Clear ink from the screen if YES, keep ink if NO.

Declared In

SCWSingleCharWidget.h

configureWithBundle:andConfig:

Configure handwriting recognition engine. This method is non-blocking and returns immediately.

Configuration is a lengthy process that may take up to several seconds, depending on the handwriting resources to be configured. It is recommended to setup a configuration listener to detect the end of the configuration process.

- (void)configureWithBundle:(NSString *)bundleName andConfig:(NSString *)configName

Parameters

bundleName

Name of the configuration bundle (for example, “en-US”).

configName

Name of the configuration mode (for example, “text”).

Declared In

SCWSingleCharWidget.h

disableGesture:

Disable detection of the specified gesture.
Several gestures may be enabled at once by combining several gesture flags using an OR operation.

- (void)disableGesture:(int)gesture

Parameters

gesture

Gesture(s) to disable.

See Also

Declared In

SCWSingleCharWidget.h

enableGesture:

Enable detection of the specified gesture.
Several gestures may be enabled at once by combining several gesture flags using an OR operation.

- (void)enableGesture:(int)gesture

Parameters

gesture

Gesture(s) to enable.

All gestures: SCWGestureAllGestures = 0xffffffff
Single tap gesture: SCWGestureSingleTap = 0x00000001
Long press gesture: SCWGestureLongPress = 0x00000002
Backspace gesture: SCWGestureBackspace = 0x00000004
Return gesture: SCWGestureReturn = 0x00000008
Space gesture: SCWGestureSpace = 0x00000010

The mul-lk-gesture.res handwriting resource is required to be able to detect gestures and must be added to the configuration script of the .lang file used during configuration.

Declared In

SCWSingleCharWidget.h

gestureEnabled:

Return whether specified gesture is enabled.

- (BOOL)gestureEnabled:(int)gesture

Parameters

gesture

Gesture flag.

Return Value

YES if gesture is enabled, NO otherwise.

See Also

Declared In

SCWSingleCharWidget.h

insertString:

Insert the given string at the insertion point. This method inserts the given string into the input stream of the handwriting recognizer without freezing strokes. This method is particularly useful when implementing space or any other button.

This method may be ignored if the widget is not configured, as the recognition mode could not be automatically detected and this information is required. If you plan on using this API before widget is configured, please consider setting the recognition mode explicitly using the provided API method.

- (void)insertString:(NSString *)string

Parameters

string

String to insert at the insertion point.

Declared In

SCWSingleCharWidget.h

penAbort

Simulate a pen abort event. This simulates a user writing.

- (void)penAbort

Declared In

SCWSingleCharWidget.h

penDown:

Simulate a pen down event. This simulates a user that starts writing.

- (void)penDown:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SCWSingleCharWidget.h

penMove:

Simulate a pen move event. This simulates a user writing.

- (void)penMove:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SCWSingleCharWidget.h

penUp:

Simulate a pen up event. This simulates a user that ends writing.

- (void)penUp:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SCWSingleCharWidget.h

registerCertificate:

Register MyScript engine certificate.

- (BOOL)registerCertificate:(NSData *)certificate

Parameters

certificate

Certificate to register.

Return Value

YES on success, NO on failure.

Declared In

SCWSingleCharWidget.h

replaceCharactersInRange:withText:

Replace characters in the text. This method can be used to select an alternate handwriting recognition candidate for any word or character. The specified character range shall span a word or a single character, and the provided replacement text shall be one of the possible candidates to trigger a word or character candidate change.

Characters may be inserted at any location in the text by calling this method with the same start and end character indices and a non-empty replacement string.

Characters may be deleted from the text by calling this method with a non-empty characters range and an empty or nil replacement string.

- (BOOL)replaceCharactersInRange:(NSRange)range withText:(NSString *)text

Parameters

range

Range of characters to replace.

text

Replacement text string (may be nil).

Return Value

YES if the operation has been applied, NO if the index range is invalid or the widget is busy processing.

Declared In

SCWSingleCharWidget.h

wordCandidatesAtIndex:

Return alternate candidate info for the word at specified index. This method computes the character range of the word at specified index, and provides alternate candidates and possible completions.

Alternate candidates can be selected by calling the replaceCharactersInRange:withText: method with parameters from the candidate information object.

- (IMCandidateInfo *)wordCandidatesAtIndex:(NSInteger)index

Parameters

index

Character index within or before the word.

Return Value

Candidate information for the word at specified index or nil if index is out of bounds.

Declared In

SCWSingleCharWidget.h