Zur Startseite

JRSpellChecker

Zur Homepage

SpellCheckLastInput (ByVal xhwnd As Long, ByVal controllltype As Bindto) As Boolean

Function:

will spell check the last input and marks the incorrect word with the style already selected.

If you have the AutoCorrection function active, then all in the autocorrectionlist defined words will be directly replaced.
The replace is in use of the ChangeWord event.

         

ico_syntax Syntax:

JRSpell1.Spellchecklastinput x.hwnd, xtype

x.HWND

HWND of the RTF-Control, the textbox or the textcontrol

x.type

xRtf_Control=1, xText_Box=2, xTX_Textcontroll=3; NetRtf_Control=11

       

ico_weitere   Return value:


True if the last typed word was correct.

Fires the TextSpellChecked Event

Example RTF-Control:

Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim
oldsel As Long
Static
Lastcheckedword As String
  Select Case KeyCode
  Case 32, 13, 40, 37, 38, 39, 188, 189, 190, 49, 50
     
oldsel = RichTextBox1.SelStart
        JRSpell1.AutoCorrectionOn
        erg = JRSpell1.SpellCheckLastInput(RichTextBox1.hWnd, Rtf_Control)
        JRSpell1.AutoCorrectionOff
         
'popup only the first time
          If erg = False And Lastcheckedword<>JRSpell1.SpellCheckLastInput_GetWord Then
            Beep
            'Example
popup a list with suggestions
            JRSpell1.PopupCharPos RichTextBox1.SelStart, ichTextBox1.hWnd, Rtf_Control
            'Set the cursor back to the
editposition
            RichTextBox1.SelStart =
oldsel +JRSpell1.SpellInfo_StartposOffset
          RichTextBox1.SetFocus
          End If
       
Lastcheckedword = JRSpell1.SpellCheckLastInput_GetWord
  End Select
End Sub

Example TX-Textcontrol:

Private Sub TXTextControl1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim
oldsel As Long
Static
Lastcheckedword As String
  Select Case KeyCode
  Case 32, 13, 40, 37, 38, 39, 188, 189, 190, 49, 50
       
oldsel = TXTextControl1.SelStart
        JRSpell1.AutoCorrectionOn
        erg = JRSpell1.SpellCheckLastInput(TXTextControl1.hWnd, TX_Textcontroll)
        JRSpell1.AutoCorrectionOff
          If erg = False And
Lastcheckedword <> JRSpell1.SpellCheckLastInput_GetWord Then
            Beep
            'Example
popup a list with suggestions
            JRSpell1.PopupCharPos TXTextControl1.SelStart, TXTextControl1.hWnd, TX_Textcontroll
            'Set the cursor back to the
editposition
            TXTextControl1.SelStart =
oldsel + JRSpell1.SpellInfo_StartposOffset
            TXTextControl1.SelLength = 0
            TXTextControl1.SetFocus
          End If
       
Lastcheckedword = JRSpell1.SpellCheckLastInput_GetWord
  End Select
End Sub

Example Textbox:

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim
oldsel As Long
Static
Lastcheckedword As String
  Select Case KeyCode
  Case 32, 13, 40, 37, 38, 39, 188, 189, 190, 49, 50
     
oldmark = JRSpell1.SelectionMethod
       
oldsel = Text1.SelStart
        JRSpell1.SelectionMethod =
Sel_nothing
        JRSpell1.AutoCorrectionOn
        erg = JRSpell1.SpellCheckLastInput(Text1.hWnd, Text_Box)
        JRSpell1.AutoCorrectionOff
          'Example
popup a list with suggestions
         
'popup only the first time
          If erg = False And
Lastcheckedword <> JRSpell1.SpellCheckLastInput_GetWord Then
            Beep
            JRSpell1.SelectionMethod =
oldmark
            JRSpell1.PopupCharPos Text1.SelStart,
Text1.hWnd, Text_Box
            'take the cursor back to the
editposition
            Text1.SelStart =
oldsel + JRSpell1.SpellInfo_StartposOffset
            Text1.SetFocus
          End If
       
Lastcheckedword =JRSpell1.SpellCheckLastInput_GetWord
        JRSpell1.SelectionMethod =
oldmark
  End Select
End Sub