Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Found at End of Search 2

Status
Not open for further replies.

harryjr

Programmer
Jan 4, 2001
27
US
Is there any way to evaluate "Not Found" returned by a
"Ctrl-F Search" within a program?
 
when you say "Within A Program" Do you mean?
1. When modifying a PRG
2. A text search with a locate command in a running program.

If 1. I do not think there is a way
if 2. found()
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
David,

In a Foxpro program I search for a character string in a
large Memo field by stuffing the KEYBOARD buffer with
"Ctrl+F" (KEYBOARD "{Ctrl+F}"), then stuff the cstring to find (KEYBOARD "cstring"), then move the cursor to the "FIND" Button (KEYBOARD "{dnarrow}" twice), then (KEYBOARD "{enter}") executes the search.

I want to be able to evaluate if the program returns a "Not Found".

I can do the same thing with AT() command but I would like to know if there is anyway to capture the response from the
Ctrl-F search.

Harryjr

 
I have not found any documentation of a stored value for a the find feature. As I can not answer your question.
However
Since you are using a memo field I suggest you look at the ATLINE() or ATCLINE() functions. They are faster in a memeo search then AT(). David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
If you like a challenge ...

After a successful search, the found text is selected in the memo field. So:

You could, after the {Ctrl+F}, issue a {Ctrl+C}, to copy the text to the clipboard. Then use
Code:
If _cliptext== ""
to test whether the clipboard contains anything - ie whether your search text was found.


There are certainly pitfalls:

1) Before doing the second and subsequent {Ctrl+F} you will have to deselect the selected text. You can achieve this by using
Code:
Keyb "{RightArrow}{LeftArrow}"
(at the risk of sometimes misplacing the cursor by a character) because moving the cursor will clear the selection.

2) You probably have to clear the clipboard before each search as well:
Code:
_cliptext=""

If you're really keen, I think it could all work ;-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top