How to Implement CTRL+G Functionality to "Find Again"ID: Q132357 The information in this article applies to:
SUMMARYThis article shows by example how to find another occurrence of a string in a file (Find Again) when the CTRL+G key combination is pressed.
MORE INFORMATIONIn FoxPro version 2.x, the Find dialog is activated by pressing CTRL+F. To find another occurrence of a string in a text file, you can press CTRL+G key, and a new search is performed. Visual FoxPro uses a Find dialog common to Windows-based applications on a specific platform. With this dialog, pressing CTRL+G no longer performs a "Find Again" operation. You can, however, program this functionality by explicitly calling the Find window when CTRL+G is pressed.
Step-by-Step ExampleThe following example code illustrates this method. To execute the sample code, follow these steps: 1. Copy and paste the code into a program (.PRG) file named FINDAGN. 2. Run the program by typing DO FINDAGN in the Command window. 3. Open a text file, and press CTRL+F. The Find dialog is activated. Type a 4. Press CTRL+G to find the string again.
Code Sample* : Find Again for Visual FoxPro using Ctrl+G. * Parameter List....: tlFindMode *-- To execute Find Again, press {Ctrl+G}. LPARAMETERS tlFindMode LOCAL lcDoCommand *-- If not find mode, initialize {Ctrl+G}. IF NOT tlFindMode ENDIF
*-- If Find dialog is not active, stuff keyboard with {Ctrl+F} and * stuff {ENTER} in keyboard to execute Find. IF NOT WEXIST('Find') ENDIF
*-- Activate Find dialog window and stuff {ENTER} in keyboard to * execute Find. ACTIVATE WINDOW Find KEYBOARD '{ENTER}' PLAIN RETURN Additional reference words: 3.00 COMMDLG VFoxWin KBCategory: kbinterop kbcode KBSubcategory: FxinteropPrevfox |
Last Reviewed: July 28, 1995 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |