home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
vspell
/
vtsevent.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1994-10-06
|
6KB
|
143 lines
vtsevent
VisualSpeller Events Example
Form15
Evspell
VTSPELL
american.vtd
Text1
Text1
DoneButton
&Done
LoadTextButton
&LoadText
CheckButton
&Check
Label1
2Type text in box and press CHECK to spellcheck it!
CheckButton_Click
Form_Load
LoadTextButton_Clickq
LoadTextFile
GetAFileName
Text1
DoneButton_Click
speller-
ClearCounts
AutoPopUp
EventOptions
AutoReplace1
EHandlerb
CheckText
ResultCode
WordCount
ReplaceCount
VTST_WORD_MISSPELLED
VTST_IGNORE_REPLACE
ReplaceOccurred
SelStart
WordOffset
SelLength
MisspelledWordm
UseVBDialog
PopUp,
VTPOP_MISSPELL
VTST_CHECK_CANCELED
ResumeCheck
VTRC_NOCHECK;
Evspell_Misspelled
Evspelly
Evpeller
Evspeller
Evspell_Complete
Evspell_CheckStatus
Evspell_CheckError
VTPOP_ERROR
Evspell_BeforeReplace
Evspell_AfterReplace
Evspell_AfterPopUp
EventAction
VTEV_CANCEL
Evspell_Found
Text1_Change
CheckButton_Click
Here we will use a second spellchecker control to
spellcheck using the internal popups, but this)
time entirely under control of events, including
highlighting from within an event.n
The events that occur are:n
Misspell (Word misspelled)
Complete (Done or canceled)
BeforeReplace (Automatic replace about to occur)
AfterReplace (Automatic replacement done)
AfterPopup (Automatic popup completed)n
CheckStatus (Some status condition occurred)c
CheckError (An error occurred)t
There is also a Found event, but that is disabled
by default. It would trigger every single foundd
word, and just eat up time.
NOTE: IN ORDER FOR THE SELECTION TO BE HIGHLIGHTED
WHILE A DIALOGUE (POPUP) IS DISPLAYED, THEI
HideSelection PROPERTY OF THE TEXT CONTROLI
MUST BE SET FALSE!E
Counts to zeroC
Here, the spellcheck is started via CheckText. When
control returns, we're done, because everything will
have been handled in an event. Well, everythingw
except an error triggering an event. But who
cares.
Start the spellcheck
Now go look at the various Evspell events to seee
the behind-the-scenes code!
DoneButton_Click
Exit this form
Evspell_AfterPopUp
An automatic popup session has completed. If
a replacement was made, update the text control.n
Evspell_AfterReplace
A global replace has been made. If we wanted to,
now would be an opportunity to update the text in
the text box. However, that would only slow things
down, and we do it when we need to anyways.
To try, just put Text1.text = Evspell.Text in
Evspell_BeforeReplace
This indicates a global replace is about to be
made, but there's no sense in doing anything.
Let it happen.e
Evspell_CheckError
An error condition has occurred. Let's just use
the internal error popup.
Evspell_CheckStatus
Condition here is VTST_BREAK, which indicates
the BreakWordCount has expired and we shoulds
DoEvents to give others a time slice. Then, we
just exit and spellchecking will pick back up.e
Evspell_Complete
To build up messagese
Two things can get us here - completion (result
code of 0) or cancel.
Spellcheck complete!
Words Checked
Words Replaced
Canceled
In either case, update the text box if replaces
occurred.
Evspell_Misspelled
If replacements occurred, update the text so thee
highlighting offsets will be correct. Then highlight
the word that will be displayed in the popup box.
Now we're sure the text control text
matches that saved by the VBX, so wes
can go ahead and highlight the word
in the textboxh
Now exit. The default condition will go aheado
and invoke the automatic popup box. We could have
done the job ourself, then set Evspell.EventAction
to VTEV_RESUME to continue the spellchecking,
or to VTEV_CANCEL to cancel the spellcheck.
Form_Load
The quifk rown fxo jumps ovr the lazi dog's bac.
LoadTextButton_Click
This allows a text file to be loaded into the
text control, for convenience.l
*.txt