Q135626: HOWTO: How to Select Field on Entry on a Form in Visual FoxPro
Article: Q135626
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0
Operating System(s):
Keyword(s):
Last Modified: 01-SEP-1999
-------------------------------------------------------------------------------
The information in this article applies to:
- Microsoft Visual FoxPro for Windows, version 3.0
-------------------------------------------------------------------------------
SUMMARY
=======
The Screen Designer in FoxPro version 2.x products has a check box in the Field
dialog box under Options labeled Select Field on Entry. The check box is
selected by default, and the format picture clause "@K" is generated for the
field so that when the form is run and the field entered, its contents are
selected. This option is no longer set by default in Visual FoxPro.
MORE INFORMATION
================
To achieve the same select-on-entry behavior in Visual FoxPro, use any one of
these techniques:
- Set the Format property of each text box to K, and set SelectedBackColor to
0,0,128.
-or-
- Add the following lines of code to the Init event procedure of the form:
THISFORM.SetAll("Format","K","Textbox")
THISFORM.SetAll("SelectedBackColor",RGB(0,0,128),"Textbox")
-or-
- In the GotFocus event procedure of a text object, enter this code:
NODEFAULT
textbox::GotFocus
this.sellength=LEN(<fldname>)
-or-
- In the GotFocus method of the object, place the following code:
IF !EMPTY(this.value)
KEYBOARD "{end}"
KEYBOARD "{shift+home}"
ENDIF
Additional query words: VFoxWin selected text seltext selstart
======================================================================
Keywords :
Technology : kbVFPsearch kbAudDeveloper kbVFP300
Version : WINDOWS:3.0
Issue type : kbhowto
=============================================================================
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.