Inherits from UIView
Declared in SLTWSingleLineWidget.h

Overview

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

Tasks

Properties

autoScrollDelay

Set parameters of the auto-scroll delay. The writing area scrolls automatically after a delay once the user has finished writing. This delay is computed from the nearly full / nearly empty delay values provided to this method.

After each stroke, the widget computes the amount of visible space left on the screen and available for writing. If the visible portion of the writing area is nearly full, the widget will compute a scroll delay that is close to the {@code autoScrollDelayWhenNearlyFull} value. If the visible portion of the writing area is nearly empty, the widget will compute a scroll delay that is close to the {@code autoScrollDelayWhenNearlyEmpty} value. In-between delay values are computed if the visible portion of the writing area is half full.

Typically, leaving delays as their default values, the widget scrolls the writing area automatically after a long delay if there is a lot of space available for writing. The widget scrolls the writing area automatically after a short delay if there is little space available for writing.

@property (nonatomic, readwrite) int autoScrollDelay

Discussion

Delay in milliseconds.

Declared In

SLTWSingleLineWidget.h

autoScrollEnabled

Set auto-scroll enabled flag. YES if auto-scroll is enabled NO otherwise.

@property (nonatomic, readwrite) BOOL autoScrollEnabled

Declared In

SLTWSingleLineWidget.h

autoScrollMargin

The amount of content left on the screen after the widget has automatically scrolled to the end of the content.
min = 0

@property (nonatomic, readwrite) CGFloat autoScrollMargin

Declared In

SLTWSingleLineWidget.h

autoTypesetDelay

Set parameters of the auto-typeset delay. The widget turns ink into characters (typesets) automatically after a delay once the user has finished writing. This delay is computed from the nearly full / nearly empty delay values provided to this method.

After each stroke, the widget computes the amount of visible space left on the screen and available for writing. If the visible portion of the writing area is nearly full, the widget will compute a typeset delay that is close to the {@code autoTypesetDelayWhenNearlyFull} value. If the visible portion of the writing area is nearly empty, the widget will compute a typeset delay that is close to the {@code autoTypesetDelayWhenNearlyEmpty} value. In-between delay values are computed if the visible portion of the writing area is half full.

Typically, leaving delays as their default values, the widget triggers a typeset of the ink after a short delay if there is a lot of space available for writing. The widget triggers a typeset of the ink after a long delay if there is little space available for writing.

@property (nonatomic, readwrite) int autoTypesetDelay

Discussion

Delay in milliseconds.

Declared In

SLTWSingleLineWidget.h

autoTypesetDelayWhenNearlyEmpty

Set parameters of the auto-typeset delay. Delay in milliseconds applied when the visible portion of the writing area is nearly empty.
min = 100
max = 10000

@property (nonatomic, readwrite) int autoTypesetDelayWhenNearlyEmpty

Declared In

SLTWSingleLineWidget.h

autoTypesetEnabled

Set auto-typeset enabled flag. Return YES if auto-typeset is enabled NO otherwise.

@property (nonatomic, readwrite) BOOL autoTypesetEnabled

Declared In

SLTWSingleLineWidget.h

baselineColor

Set the color of the baseline.

@property (nonatomic, readwrite) UIColor *baselineColor

Declared In

SLTWSingleLineWidget.h

baselinePosition

The position of the baseline from the top of the writing area. min = 0

@property (nonatomic, readwrite) CGFloat baselinePosition

Declared In

SLTWSingleLineWidget.h

baselineThickness

Set the thickness of the baseline. min = 1 max = 15 default = 2

@property (nonatomic, readwrite) CGFloat baselineThickness

Declared In

SLTWSingleLineWidget.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

SLTWSingleLineWidget.h

cursorBottomMargin

Bottom margin of the cursor bar in pixels, measured from the position of the baseline.
min = 0

@property (nonatomic, readwrite) CGFloat cursorBottomMargin

Declared In

SLTWSingleLineWidget.h

cursorIndex

The position of the cursor. Positioning the cursor inside the text selects the word at the position of the cursor. Moving the cursor out of the bounds of the text (i.e. at a negative index or past the length of the text) hides the cursor and clears the selection.

@property (nonatomic, readwrite) int cursorIndex

Declared In

SLTWSingleLineWidget.h

cursorResource

Set the appearance of the cursor.
The image could be nil.

@property (nonatomic, readwrite) UIImage *cursorResource

Declared In

SLTWSingleLineWidget.h

cursorTopMargin

Top margin of the cursor bar in pixels, measured from the top of the text.
min = 0

@property (nonatomic, readwrite) CGFloat cursorTopMargin

Declared In

SLTWSingleLineWidget.h

errorCode

Error code describing the error.

No error: SLTWErrorCodeNoError = 0
Invalid certificate: SLTWErrorCodeInvalidCertificate = 1
Invalid API key: SLTWErrorCodeInvalidAPIKey = 2
Cannot load handwriting resource: SLTWErrorCodeCannotLoadHandwritingResource = 3
Cannot create user lexicon resource: SLTWErrorCodeCannotCreateUserLexiconResource = 4
Cannot create subset knowledge resource: SLTWErrorCodeCannotCreateSubsetKnowledgeResource = 5
Error setting internal property: SLTWErrorCodeCannotSetProperty = 6

@property (nonatomic, readonly) SLTWErrorCode errorCode

Declared In

SLTWSingleLineWidget.h

errorString

String describing the last configuration error.

@property (nonatomic, readonly) NSString *errorString

Declared In

SLTWSingleLineWidget.h

font

The font and style in which the text should be displayed.

@property (nonatomic, readwrite) UIFont *font

Declared In

SLTWSingleLineWidget.h

inkColor

Color of the ink.

@property (nonatomic, readwrite) UIColor *inkColor

Declared In

SLTWSingleLineWidget.h

inkWidth

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

@property (nonatomic, readwrite) CGFloat inkWidth

Declared In

SLTWSingleLineWidget.h

longPressDelay

Set the delay after which long press event is triggered. delay Long press delay in milliseconds.
min = 100 ms
max = 10000 ms

@property (nonatomic, readwrite) double longPressDelay

Declared In

SLTWSingleLineWidget.h

scrollOffset

Return the scrolling offset point of the writing area.

@property (nonatomic, readonly) CGPoint scrollOffset

Declared In

SLTWSingleLineWidget.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) NSInteger speedQualityCompromise

Discussion

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

Declared In

SLTWSingleLineWidget.h

text

Text managed by this widget.

@property (nonatomic, readwrite) NSString *text

Declared In

SLTWSingleLineWidget.h

textColorNormal

The color of the text for the normal state.

@property (nonatomic, readwrite) UIColor *textColorNormal

Declared In

SLTWSingleLineWidget.h

textColorSelected

The color of the text for the selected state.

@property (nonatomic, readwrite) UIColor *textColorSelected

Declared In

SLTWSingleLineWidget.h

textMargin

The text margin before the text.

@property (nonatomic, readwrite) CGFloat textMargin

Declared In

SLTWSingleLineWidget.h

textSize

The size of the text and disable automatic font size selection. default = 90

@property (nonatomic, readwrite) CGFloat textSize

Declared In

SLTWSingleLineWidget.h

textSizes

The range of allowed text sizes used for automatic font size selection.

@property (nonatomic, readwrite) NSArray *textSizes

Declared In

SLTWSingleLineWidget.h

transientSpaceEnabled

Enable or disable transient space feature. A space mark is shown right after the content in the baseline, as a dashed line. This space mark is called transient space.

If the user writes into the transient space area, the space mark disappears and this indicates that no space shall be added between the actual content and what the user is writing. If the user writes beyond the transient space area, a space character shall be added by the widget between the actual content and what the user is writing.

@property (nonatomic, readwrite) BOOL transientSpaceEnabled

Discussion

YES if transient space feature is enabled, NO otherwise.

Declared In

SLTWSingleLineWidget.h

userLexicon

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

@property (nonatomic, readwrite) NSArray *userLexicon

Declared In

SLTWSingleLineWidget.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

SLTWSingleLineWidget.h

writingAreaBackground

The background of the writing area to the given drawable.
The background image could be nil.

@property (nonatomic, readwrite) UIImage *writingAreaBackground

Declared In

SLTWSingleLineWidget.h

writingAreaBackgroundColor

The background of the writing area to the given color.

@property (nonatomic, readwrite) UIColor *writingAreaBackgroundColor

Declared In

SLTWSingleLineWidget.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.

- (void)addSearchDir:(NSString *)directoryName

Parameters

directoryName

Path to a folder containing handwriting resources.

Declared In

SLTWSingleLineWidget.h

addStroke:

Add a stroke to the widget.

- (void)addStroke:(NSArray *)listCaptureInfo

Parameters

listCaptureInfo

List of capture information.

Declared In

SLTWSingleLineWidget.h

centerTo:

Center the writing area around the given character index. The widget scrolls the writing area so that the given character index is located at the center of the screen, if possible.

The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)centerTo:(int)index

Parameters

index

Character index to put at the center of the screen.

See Also

Declared In

SLTWSingleLineWidget.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 before the character.

Return Value

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

Declared In

SLTWSingleLineWidget.h

clear

Clear ink and text contained in the widget.

- (void)clear

Declared In

SLTWSingleLineWidget.h

clearSearchPath

Clear handwriting resources search path.

- (void)clearSearchPath

Declared In

SLTWSingleLineWidget.h

clearSelection

Clear the current text selection.

- (void)clearSelection

Declared In

SLTWSingleLineWidget.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

SLTWSingleLineWidget.h

disableGesture:

Disable detection of specified gesture(s).

- (void)disableGesture:(int)gesture

Parameters

gesture

flag to disable

See Also

Declared In

SLTWSingleLineWidget.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: SLTWGestureAllGestures = 0xffffffff
  • Single tap gesture: SCWGestureSingleTap = 0x00000001
  • Long press gesture: SCWGestureLongPress = 0x00000002
  • Return gesture: SCWGestureReturn = 0x00000008
  • Erase gesture: SLTWGestureErase = 0x00000020
  • Select gesture: SLTWGestureSelect = 0x00000040
  • Underline gesture: SLTWGestureUnderline = 0x00000080
  • Join gesture: SLTWGestureJoin = 0x00000100
  • Insert gesture: SLTWGestureInsert = 0x00000200
  • Overwrite gesture: SLTWGestureOverwrite = 0x00000400

Declared In

SLTWSingleLineWidget.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

SLTWSingleLineWidget.h

isUserScrolling

Indicates whether the user is currently scrolling the writing area. This method returns YES only if the widget is scrolling in response to the user scrolling via the scrollbar. This method returns NO if the widget is currently scrolling due to auto-scrolling or in response of any of the scrolling methods.

- (BOOL)isUserScrolling

Return Value

YES if the user the currently scrolling the writing area using the scrollbar, NO otherwise.

Declared In

SLTWSingleLineWidget.h

moveCursorToVisibleIndex

Move the cursor to a visible position within the viewport.

- (BOOL)moveCursorToVisibleIndex

Return Value

YES if the cursor was moved outside of the viewport. NO otherwise.

Declared In

SLTWSingleLineWidget.h

penAbort

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

- (void)penAbort

Declared In

SLTWSingleLineWidget.h

penDown:

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

- (void)penDown:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SLTWSingleLineWidget.h

penMove:

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

- (void)penMove:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SLTWSingleLineWidget.h

penUp:

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

- (void)penUp:(IMCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

SLTWSingleLineWidget.h

registerCertificate:

Register MyScript engine certificate

- (BOOL)registerCertificate:(NSData *)certificate

Parameters

certificate

Certificate to register. return YES on success NO on failure.

Declared In

SLTWSingleLineWidget.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 the 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

SLTWSingleLineWidget.h

scrollTo:

Scroll the writing area to the given character index. The widget defines margins on each side of the screen that are used to clamp the position of the cursor handle while scrolling. When the handle hits the left margin and the writing area can scroll left, the handle remains at the boundary of the left margin and the widget starts to scroll left. Same thing for the right margin.

The widget scrolls the writing area so that the given character index is positioned on the boundary of the left scroll margin, for left-to-right languages. For right-to-left languages, the given character index is positioned on the boundary of the right scroll margin.

The widget does not scroll if it is already scrolled all the way to the left or to the right and the requested character index is visible. Also, the widget does not scroll if the requested character index is already visible and is not inside the left or right scroll margins.

The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)scrollTo:(int)index

Parameters

index

Character index to scroll to.

See Also

Declared In

SLTWSingleLineWidget.h

scrollToCursor

Scroll the writing area, if needed, so that the cursor is visible. The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)scrollToCursor

See Also

Declared In

SLTWSingleLineWidget.h

selectCharacter:

Select the character at given index. Selecting a portion of text clears the current selection and paints the character at given index using the selection color. Only typeset characters can be selected, this method has no effect on ink. Selected characters are shown in selection color once they become typeset.

- (void)selectCharacter:(int)index

Parameters

index

Character index within or before the character.

Declared In

SLTWSingleLineWidget.h

selectWord:

Select the word at given index. Selecting a portion of text clears the current selection and paints the word at given index using the selection color. Only typeset characters can be selected, this method has no effect on ink. Selected words are shown in selection color once they become typeset.

- (void)selectWord:(int)index

Parameters

index

Character index within or before the word.

Declared In

SLTWSingleLineWidget.h

selectionIndex

Return the current selection index.

- (int)selectionIndex

Return Value

Character index of the selection index.

Declared In

SLTWSingleLineWidget.h

setArrowLeftImage:forState:

Set the appearance of the left scroll arrow for the states (normal, highlighted). Left scroll arrow is disabled if drawable is null.

- (void)setArrowLeftImage:(UIImage *)image forState:(UIControlState)state

Parameters

image

for the left arrow.

state

the state (normal or highlighted).

Declared In

SLTWSingleLineWidget.h

setArrowRightImage:forState:

Set the appearance of the right scroll arrow for the states (normal, highlighted). Right scroll arrow is disabled if drawable is null.

- (void)setArrowRightImage:(UIImage *)image forState:(UIControlState)state

Parameters

image

for the right arrow.

state

the state (normal or highlighted).

Declared In

SLTWSingleLineWidget.h

setAutoScrollDelayWhenNearlyEmpty:delayWhenNearlyFull:

Set the delay after which the writing area scrolls automatically once the user has finished writing. Delay in milliseconds.

- (void)setAutoScrollDelayWhenNearlyEmpty:(int)delayWhenNearlyEmpty delayWhenNearlyFull:(int)delayWhenNearlyFull

Parameters

delayWhenNearlyEmpty

Delay in milliseconds applied when the visible portion of the writing area is nearly empty.

delayWhenNearlyFull

Delay in milliseconds applied when the visible portion of the writing area is nearly full.

Declared In

SLTWSingleLineWidget.h

setAutoTypesetDelayWhenNearlyEmpty:delayWhenNearlyFull:

Set parameters of the auto-typeset delay.

- (void)setAutoTypesetDelayWhenNearlyEmpty:(int)delayWhenNearlyEmpty delayWhenNearlyFull:(int)delayWhenNearlyFull

Parameters

delayWhenNearlyEmpty

Delay in milliseconds applied when the visible portion of the writing area is nearly empty.

delayWhenNearlyFull

Delay in milliseconds applied when the visible portion of the writing area is nearly full.

Declared In

SLTWSingleLineWidget.h

setPatternImage:forState:

Set the appearance of the scrollbar background for the states (normal, highlighted). The scrollbar drawable must have been configured for this setting to take effect.

- (void)setPatternImage:(UIImage *)image forState:(UIControlState)state

Parameters

image

for the scrollbar background.

state

the state (normal or highlighted).

Declared In

SLTWSingleLineWidget.h

smoothCenterTo:

Center smoothly the writing area around the given character index. The widget scrolls the writing area so that the given character index is located at the center of the screen, if possible.

The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)smoothCenterTo:(int)index

Parameters

index

Character index to put at the center of the screen.

See Also

Declared In

SLTWSingleLineWidget.h

smoothScrollTo:

Scroll smoothly the writing area to the given character index. The widget defines margins on each side of the screen that are used to clamp the position of the cursor handle while scrolling. When the handle hits the left margin and the writing area can scroll left, the handle remains at the boundary of the left margin and the widget starts to scroll left. Same thing for the right margin.

The widget scrolls the writing area so that the given character index is positioned on the boundary of the left scroll margin, for left-to-right languages. For right-to-left languages, the given character index is positioned on the boundary of the right scroll margin.

The widget does not scroll if it is already scrolled all the way to the left or to the right and the requested character index is visible. Also, the widget does not scroll if the requested character index is already visible and is not inside the left or right scroll margins.

The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)smoothScrollTo:(int)index

Parameters

index

Character index to scroll to.

See Also

Declared In

SLTWSingleLineWidget.h

smoothScrollToCursor

Scroll smoothly the writing area, if needed, so that the cursor is visible. The scroll operation is canceled and this method does nothing if the user is currently scrolling the writing area.

- (void)smoothScrollToCursor

See Also

Declared In

SLTWSingleLineWidget.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 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

SLTWSingleLineWidget.h