Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting an item in list box in code
Message
From
28/11/1998 16:13:18
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00162137
Message ID:
00162160
Views:
16
>You can simply assign a value to the list's value property.

>loList.Value = loList.List(loList.ListIndex)

Jim,
I'm calling the following code in two places, once when in form.Show() and once when a button is clicked:

loList.Requery()
loList.LISTINDEX = 1
loList.SELECTED(loList.LISTINDEX) = .T.
loList.VALUE = loList.LIST(loList.LISTINDEX)

It is the exact same code in both places. The code in the button works fine, the first item is auto selected and highlighted. The code in the form.Show appears to select the first item (it's got the selected box around the item) but it is not highlighted as if it was clicked. This is not that big of a deal, but it's driving me nuts that I can't figure out what the difference would be. Does it possibly have something to do with the way the screen is painted since the first call is before the form is actually visible? Apparently it has more to do with when it's called not how it's done since I can replace the

loList.VALUE = loList.LIST(loList.LISTINDEX)
With
loList.Selected(loList.ListIndex) = .T.

and it works as well in the click() event, but not the form.Show
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform