Interface TextControl::setSpellCheckOption

 


Description

In BBj 7.0 and higher, this method modifies low level spell checking options.

Syntax

Return Value

Method

void

setSpellCheckOption(int option, boolean value)

Parameters

Variable

Description

option

The constants are described in TextControl

value

0 – disable option
1 – enable option

Return Value

None.

Remarks

Each of the language dictionaries is pre-set for the most common set of options. In most cases, it is not necessary to change these option settings.

Example

rem ' setSpellCheckOption

SYSGUI=UNT
OPEN (SYSGUI)"X0"

sysgui! = BBjAPI().getSysGui()
window! = sysgui!.addWindow(200,200,600,400,"Spell-Check setSpellCheckOption",$00010003$)
cedit! = window!.addCEdit(102,25,50,350,325,"",$0100$)
cedit!.setLineWrap(1)

Locale$ = stbl("!LOCALE","en_GB")
cedit!.setSpellChecked(1)

dim option[1:15]
for i=1 to 15
  dread option[i],label$
  enabled = cedit!.getSpellCheckOption(option[i])
  flags$ = iff(enabled,$0004$,$0000$)
  checkbox! = window!.addCheckBox(200+i,400,i*25,200,25,label$,flags$)
  CALLBACK(ON_CHECK_ON,enableOption,checkbox!.getContextID(),checkbox!.getID())
  CALLBACK(ON_CHECK_OFF,disableOption,checkbox!.getContextID(),checkbox!.getID())
next i

gosub InitText

CALLBACK(ON_CLOSE,APP_CLOSE,sysgui!.getContext())

REM Process Events
PROCESS_EVENTS

APP_CLOSE:
RELEASE

InitText:
  Text! = new java.util.HashMap()
  while 1
    dread text$,err=*break
    cedit!.addParagraph(-1,text$)
  wend
return

enableOption:
  i=sysgui!.getLastEvent().getControl().getID()-200
  cedit!.setSpellCheckOption(option[i],1)
  cedit!.setText(cedit!.getText())
return

disableOption:
  i=sysgui!.getLastEvent().getControl().getID()-200
  cedit!.setSpellCheckOption(option[i],0)
  cedit!.setText(cedit!.getText())
return

disableOption:
return

rem ' Options

data cedit!.CASE_SENSITIVE_OPT,"Case sensitive"
data cedit!.IGNORE_ALL_CAPS_WORD_OPT,"Ignore ALL CAPS"
data cedit!.IGNORE_CAPPED_WORD_OPT,"Ignore Initial Caps"
data cedit!.IGNORE_DOMAIN_NAMES_OPT,"Ignore domain names"
data cedit!.IGNORE_MIXED_CASE_OPT,"Ignore unusual mixed case"
data cedit!.IGNORE_MIXED_DIGITS_OPT,"Ignore mixed letters/digits"
data cedit!.REPORT_DOUBLED_WORD_OPT,"Report doubled words"
data cedit!.REPORT_MIXED_CASE_OPT,"Report unusual mixed case"
data cedit!.REPORT_MIXED_DIGITS_OPT,"Report mixed letters/digits"
data cedit!.REPORT_UNCAPPED_OPT,"Report uncapitalized words"
data cedit!.SPLIT_CONTRACTED_WORDS_OPT,"Apostrophes (') separate words"
data cedit!.SPLIT_HYPHENATED_WORDS_OPT,"Hypens (-) separate words"
data cedit!.SPLIT_WORDS_OPT,"Spell-check sub-words"
data cedit!.STRIP_POSSESSIVES_OPT,"Remove xxx's before spell-checking"
data cedit!.SUGGEST_SPLIT_WORDS_OPT,"Suggestions should split words"

rem ' Sample text

data "america."
data ""
data "ROI = return on investment."
data ""
data "Luke Skywalker."
data ""
data "nytimes.com, support@basis.cloud"
data ""
data "FmtString"
data ""
data "K1A 0A9"
data ""
data "Friday March16."
data ""
data "apostrophe'separates'words"
data ""
data "John's computer."
data ""
data "The quickbrown foxjumped overthe lazydog."

See Also

BBjAPI

BBjSysGui

BBjControl

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.