Zur Startseite

JRSpellChecker

Zur Homepage

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

Funktion:

prüft die zuletzt gemachten Eingaben auf Fehler und markiert das fehlerhafte Wort mit dem bereits gewählten Stil und der festgelegten Farbe.

Sollte die Autokorrekturfunktion aktiv sein, werden in der Autokorrekturliste definierte Wörter nicht markiert, sondern direkt ersetzt.
In diesem Fall wird das Event ChangeWord aufgerufen.

       

ico_syntax   Syntax:

JRSpell1.Spellchecklastinput x.hwnd, xtype

x.HWND

HWND des RTF-Steuerelements, der Textbox oder des Textcontrols

x.type

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

       

ico_weitere   Rückgabewert:


True wenn das zuletzt eingegebene Wort ohne Fehler ist.

löst TextSpellChecked Event aus

Beispiel 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

Beispiel 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

Beispiel 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