Interface TextControl
Description
In BBj 7.00 and higher, all text-based BBjControls implement the TextControl interface. When spell checking is enabled, the text control monitors the user's typing, underlines misspelled words, and adds a popup menu with options to correct spelling mistakes.
Implementing Classes
BBjCEdit, BBjEditBox, BBjEditBoxSpinner, BBjInputD, BBjInputDSpinner, BBjInputE, BBjInputESpinner, BBjInputN, BBjInputNSpinner, BBjInputT, BBjInputTSpinner, BBjListEdit
Methods of TextControl
Constants
The following constants are used by the setSpellCheckOption and getSpellCheckOption methods:
Constant | Description |
---|---|
CASE_SENSITIVE_OPT |
Controls whether to check spelling with regard to differences in letter case (e.g., treating america and America as two separate words) or by ignoring differences in letter case. (e.g., treating america and America as the same word). Keeping this option enabled improves performance (because the spell check dictionaries are optimized for case-sensitive access) and ensures that capitalization errors are detected. You might disable this option when checking text entered in all-caps, for example. |
IGNORE_ALL_CAPS_WORD_OPT |
Controls whether the spell checker automatically skips (ignores) words containing just capital letters. If the text contains many abbreviations or acronyms, setting this option prevents them from being reported as spelling errors. |
IGNORE_CAPPED_WORD_OPT |
Controls whether the spell checker automatically skips (ignores) words starting with a capital letter. If the text contains many proper names, setting this option prevents them from being reported as spelling errors. |
IGNORE_DOMAIN_NAMES_OPT |
Controls whether the spell checker automatically skips (ignores) words which appear to be Internet domain names, URLs, email addresses, etc. |
IGNORE_MIXED_CASE_OPT |
Controls whether the spell checker automatically skips (ignores) words which contain a mixture of upper- and lower-case letters. If the text contains variable names, technical jargon, etc. (e.g., YearToDate, FmtString), setting this option prevents them from being reported as spelling errors. |
IGNORE_MIXED_DIGITS_OPT |
Controls whether the spell checker automatically skips (ignores) words which contain embedded digits. When checking general text, enabling this option will prevent strings like product codes from being reported as spelling errors. |
REPORT_DOUBLED_WORD_OPT |
The spell checker can automatically detect the same word appearing twice in a row (e.g., Minutes of the meeting were filed yesterday.) This option controls whether doubled words are reported as misspelled. |
REPORT_MIXED_CASE_OPT |
The spell checker can automatically detect words which have an unusual combination of upper- and lower-case letters (e.g., TUesday). This option controls whether mixed-case words are reported as misspelled. |
REPORT_MIXED_DIGITS_OPT |
The spell checker can automatically detect words which contain embedded digits, which might result from accidentally omitting a space (e.g., Monday14 August). This option controls whether words with embedded digits are reported as misspelled. |
REPORT_UNCAPPED_OPT |
Enable if check words should be reported whose first character is not capitalized. |
SPLIT_CONTRACTED_WORDS_OPT |
When this option is enabled, apostrophes will if necessary be treated as word separators, and each sub-word checked individually. This option is intended for use with the French and Italian dictionaries. |
SPLIT_HYPHENATED_WORDS_OPT |
When this option is enabled, hyphens ("-") will if necessary be treated as word separators, and each sub-word checked individually. |
SPLIT_WORDS_OPT |
When this option is enabled, words will if necessary be treated as a series of concatenated sub-words, and each sub-word checked individually. This option is intended for use with the German and Finnish dictionaries. |
STRIP_POSSESSIVES_OPT |
When this option is enabled, possessives of the form 's and s' will be removed from words before checking their spelling. |
SUGGEST_SPLIT_WORDS_OPT |
When this option is enabled, the Suggest function will attempt to split the misspelled word into two, and will offer the split words as suggestions if both are valid words. This is useful for correcting words incorrectly joined by a missing space -- e.g., if this option is enabled, the Suggest method would suggest the dog as a replacement for thedog. |
The following constants are used by the setHighlightOnFocus and getHighlightOnFocus methods:
Value | Constant | Description |
---|---|---|
0 |
HIGHLIGHT_NONE |
Contents of the control are never automatically highlighted when the control gets focus. |
1 |
HIGHLIGHT_KEY |
Contents of the control are automatically highlighted when the control gets focus by tabbing into it. |
2 |
HIGHLIGHT_MOUSE |
Contents of the control are automatically highlighted when the control gets focus by clicking into it with the mouse. |
3 |
HIGHLIGHT_KEY_MOUSE |
Contents of the control are automatically highlighted when the control gets focus by tabbing into it or clicking into it with the mouse. |
4 |
HIGHLIGHT_FOCUS |
Contents of the control are automatically highlighted when the control gets focus under program control. |
5 |
HIGHLIGHT_FOCUS_OR_KEY |
Contents of the control are automatically highlighted when the control gets focus under program control or by tabbing into it. |
6 |
HIGHLIGHT_FOCUS_OR_MOUSE |
Contents of the control are automatically highlighted when the control gets focus under program control or by clicking into it with the mouse. |
7 |
HIGHLIGHT_ALL |
Contents of the control are always automatically highlighted when the control gets focus. |
Remarks
By default, the spell checker will attempt to use the language specified in STBL("!LOCALE"). If STBL("!LOCALE") cannot be reconciled to a supported language code, the spell checker will use "en_US" (American English). See TextControl::setSpellCheckLanguage for a complete list of supported language codes.
The default custom dictionary can be specified in STBL("!DICTIONARY"). If this global string is not set, the spell checker will create a custom dictionary named "CUSTOM.DIC".
Spell-checking in a thin client configuration requires extra jar files that are not included by default. Because the language dictionaries are fairly large and most applications do not use all languages, the dictionary files are not included in the standard thin-client jar configuration. When deploying a client application that uses spell-checking, add the required dictionary files listed in BBj Classpath Overview to the cache archive.
Example
|
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.