ID: Q127837
The information in this article applies to:
In both FoxPro for MS-DOS and FoxPro for Unix, when you place a list box on a screen, the items in the list box are not highlighted until an item is selected from the list box.
Using the KEYBOARD command in conjunction with a variable that is evaluated in the WHEN clause of the list box object, have FoxPro highlight the first item in the list box to provide a visual indicator to the user that they are in a specific list box. See the More Information section for details.
This behavior is by design.
1. In FoxPro for MS-DOS or UNIX, issue these commands:
SET DEFAULT TO SYS(2004)+"\TUTORIAL"
USE CUSTOMER in 1
2. Issue this command:
CREATE SCREEN listtest
3. Choose Screen from the Layout menu.
4. Select the Window radio button, and name the screen LISTTEST
in the Name box.
5. Select the Screen Code, Setup check box.
6. In the LISTTEST Setup code snippet, place this command:
TRIGGERED = .F.
7. Close the setup code screen.
8. Back in LISTTEST.SCX, choose Screen, List.
9. In the List Type box, choose Prompt Field. In the Field box,
type in Company.
10. In the Variable box, type in the value LIST1.
11. In the When clause of the list box, type the following as a procedure:
IF (!Triggered)
KEYBOARD "{Home}"+"{Home}"
Triggered = .T.
ENDIF
12. Choose the OK button. Back in the List Type dialog, choose OK a second
time.
13. Choose Program, Generate from the FoxPro menu. When asked if you want
to save the environment information, choose Yes.
14. Choose Program, Do from the FoxPro menu. Select LISTTEST.SPR from the
list of programs.
15. Your screen should show one list box with the first item in the list
highlighted.
Additional reference words: FoxDos FoxUnix 2.50 2.50a 2.50b 2.60 2.60a list
box highlight
KBCategory: kbui kbprg kbprb
KBSubcategory: FxprgGeneral
Last Reviewed: March 21, 1995