Procedure to Insert Text in Read-Only Edit RegionID: Q110771 2.50 2.50a 2.50b 3.00 | 2.00 2.50 2.50a 2.50b | 2.50b
The information in this article applies to:
SUMMARYAt times you may want to insert text into a read-only edit region at the location of the cursor. Because the edit region is read-only, text cannot be inserted into the region directly. The code below demonstrates how this can be done.
MORE INFORMATIONTo obtain the location of the cursor, you must copy the text from the cursor position to the end of the file. This copied text is stored in the variable _CLIPTEXT, where the length of this variable can be compared with the length of the memo field. This comparison will result in the cursor's position. After the cursor's position has been determined, you can use the STUFF() function to insert text at the specified position. In the following sample program, the KEYBOARD command is used to stuff commands into the keyboard buffer. These keystrokes are not executed, however, until control is returned from the clauses. In this example, the ON KEY LABEL CTRL+Q command is used to trigger another function after the initial KEYBOARD commands have been executed. The second ON KEY LABEL command is disabled after it has been executed.
To test the program, place the cursor in the middle of the text string
"This is a text string". Press the F2 key, and type any additional text in
the second window. Choose the Done button when you are finished. The
additional text is added to the edit region where the cursor was located.
The cursor is moved to the beginning of the edit region.
NOTE: This routine does not work the same way in Visual FoxPro due to differences in the way it reads functions. KBCategory: KBSubcategory: FxenvMemory Additional reference words: VFoxWin 3.00 FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b
|
|
Last Reviewed: May 22, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |