PRB: SelectOnEntry Property Does Not Highlight Single Character (171983)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q171983 SYMPTOMS
When setting the SelectOnEntry property in Visual FoxPro 5.0 to True (.T.),
a single character is not highlighted when the object receives focus
with some objects.
Of all the objects in Visual FoxPro 5.0 that use the SelectOnEntry
property, the TextBox and ComboBox are the ones that do not highlight a
single character properly. The EditBox, Spinner, and Grid column objects
highlight a single character properly. If any of the object just mentioned
has more than one character in it, then the characters are highlighted
properly when the SelectOnEntry is set to True.
The same problem occurs when using the "K" setting in the Format property
of the TextBox or ComboBox. Setting the Format property to "K" selects all
text when the object receives focus. The SelectOnEntry property was not
available in Visual FoxPro 3.0. The Format property value of "K" works
properly with just one character in Visual FoxPro 3.0 and, therefore, the
workaround below is not necessary. The ComboBox in Visual FoxPro 3.0 does
not have a Format property or the SelectOnEntry property.
RESOLUTION
To allow a single character to become highlighted in a TextBox or ComboBox,
check the length of the value to see if it is a single character. If it is
only one character in length, using the KEYBOARD command allows the
character to be highlighted. Place the following code into the Gotfocus
event:
IF LEN(ALLTRIM(THIS.VALUE)) = 1 && Use This.Value works for
* textboxes,
KEYBOARD '{shift + home}' && and This.DisplayValue for
* Comboboxes.
KEYBOARD '{shift + rightarrow}'
ENDIF
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
Modification Type: | Major | Last Reviewed: | 8/21/1999 |
---|
Keywords: | kbprb KB171983 |
---|
|