gettingstarted
[Top] [All Lists]

find method msgbox replaces text with keyboard shortcut

To: gettingstarted at lists dot realsoftware dot com
Subject: find method msgbox replaces text with keyboard shortcut
From: spake at surewest dot net
Date: Wed, 26 Nov 2003 22:10:41 -0800
Priority: normal
The method below is used to find the next occurrence of a text 
string (in this case, the text in "Value") It works fine for the most 
part. The problem occurs when the search string is initially found, 
but on a subsequent call, the text is not found. When I click the "ok" 
button on the message box, the app replaces the highlighted text  
from the previous successful find with the letter "g". Now, I am 
using ctrl - g as the keyboard shortcut, so that explains the letter. 
But why is it replacing the text at all?

I don't think it would be hard to fix, just set the SelLength to 0 prior 
to the call to msgbox,. I'd just like to know why it's happening

Dim FoundAt, BeginSearch As Integer
  
  BeginSearch =Self.TextField.SelStart + Self.TextField.SelLength 
+ 1
  FoundAt=InStr(BeginSearch,TextField.Text,Value)
  If FoundAt > 0 then
    TextField.SelStart=FoundAt - 1
    TextField.SelLength=Len(Value)
  Else
    Beep
    MsgBox "The text " +chr(34)+Value+Chr(34)+" Could not be 
found."
  End if

 - - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>