gettingstarted
[Top] [All Lists]

Re: find method msgbox replaces text with keyboard shortcut

To: "Getting Started" <gettingstarted at lists dot realsoftware dot com>
Subject: Re: find method msgbox replaces text with keyboard shortcut
From: "CV" <atauqua at hit dot net>
Date: Thu, 27 Nov 2003 05:13:38 -0600
References: <3FC524E1 dot 1140 dot 10D2358 at localhost>
The reason that the last found string is replaced is because it is still
selected as a result of the previous find. A keyboard entry like "g" then
just replaces selected text in the normal manner.

Jack

>Subject: find method msgbox replaces text with keyboard shortcut


> 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>