The sequence goes like this....
1. Enter text to find in an editfield.
2. The text is found and highlighted by find method.
3. Ctrl-g calls the FindNext method below, which finds the next
occurrence of the text string and selects it.
4. Ctrl-g is called repeatedly until InStr returns 0 (there are no more
occurnces of the text string). When this happens, a msgbox pops
up stating that the text could not be found.
5. It is after the msgbox button is pressed that the selected text is
replaced.
I guess the ctrl-g is held in a buffer until the msgbox is dismissed.
After which, because the menu handler is no longer running, the
characters are sent as regular text to the app? Seems kind of
clunky to me.
> Getting Started Digest #114 - Thursday, November 27, 2003
>
> find method msgbox replaces text with keyboard shortcut
> by <spake at surewest dot net>
> Re: find method msgbox replaces text with keyboard shortcut
> by "CV" <atauqua at hit dot net>
>
>
> ----------------------------------------------------------------------
>
> Subject: find method msgbox replaces text with keyboard shortcut
> From: <spake at surewest dot net>
> Date: Wed, 26 Nov 2003 22:10:41 -0800
>
> 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
>
> ----------------------------------------------------------------------
>
> 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
>
> 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
>
>
>
> ----------------------------------------------------------------------
> End of Getting Started Digest
>
> - - -
> Unsubscribe or switch delivery mode:
> <http://support.realsoftware.com/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
>
- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|