How to Move the Cursor to the End of an @ ... EDIT FieldID: Q103089 2.5x 2.60a | 2.5x 2.60 2.60a | 2.5x 2.60 2.60a
The information in this article applies to:
SUMMARYIn order to facilitate text editing, you may need to place the cursor at the end of an edit region both upon entering a screen and upon moving to another record in the database. Listed below are two different methods of doing this.
MORE INFORMATION
Method 1To begin editing at the end of a field created with @ ... EDIT, use the WHEN clause of the @ ... EDIT command to send CTRL+A and RIGHT ARROW keystrokes to the keyboard buffer. Normally, the cursor will appear at the first character in the field when the cursor is moved to an @ ... EDIT field. However, if CTRL+A and the RIGHT ARROW key are pressed, the cursor will appear at the end of the data. To automatically move the cursor whenever it enters of an @ ... EDIT field, these keystrokes must be sent to the keyboard buffer through the WHEN clause of the @ ... EDIT field. NOTE: For the CTRL+A key combination to work properly, the FoxPro system menu must contain the Select All menu command (_MED_SLCTA) on the default Edit menu (_MSM_EDIT), and the shortcut key for the Select All menu command must be defined as CTRL+A. The following code demonstrates how to move to the last character of an @ ... EDIT field.
Method 2In order to describe the steps necessary to create a screen that automatically moves the cursor to the bottom of an edit region, this method makes the following assumptions:
in the Setup code for the screen in the Screen Builder. By testing this
variable in the WHEN clause of the CNO field (the first field) and then
changing its value, you can allow entry into CNO instead of always jumping
to the EDIT field. Placing the following code in the WHEN clause for the
CNO field will accomplish this:
Now that you have arranged to have your cursor move to the EDIT region, you
are ready to perform the desired function; namely, moving the cursor to the
bottom. In preparation, the EDIT region must be set so that the entire
field is SELECTed ON ENTRY. Then, place the following code in the WHEN
clause for the EDIT field:
Because the entire field is selected, you only need to code one "down
arrow" character to move to the bottom of the field. The only step
remaining is to modify the VALID procedure for the navigation buttons. This
code usually consists of a DO CASE statement to process the different
buttons. Usually, the last statement in the VALID procedure will be SHOW
GETS (used to refresh the screen). Add a line immediately before the SHOW
GETS line as follows:
This is the same statement you used in the WHEN procedure of the first
field to move the cursor to the EDIT field. When the screen is generated
and run, every time you move to another record using the buttons, the
cursor will be placed at the bottom of the EDIT field.
Additional reference words: FoxMac FoxDos FoxWin SBuilder 2.50 2.50a 2.50b 2.50c 2.60 2.60a KBCategory: KBSubcategory: FxtoolSbuilder
|
|
Last Reviewed: May 22, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |