FIX: Init Event Code to Multilselect List Box Items Fails (189505)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q189505 SYMPTOMS
When you use code in the Init event of a form to multi-select items in a
list box, the items are not correctly selected.
This behavior does not occur in Visual FoxPro version 3.0x.
CAUSE
This is a timing problem in Visual FoxPro 5.x.
RESOLUTION
To obtain the proper behavior, you can use a Timer object to control the
code that you multi-select.
Steps to Use a Timer Object- Create a form with a list box object and name the list box List1.
- In the Init event of the form , add the following code:
THIS.Timer1.ENABLED = .T.
- Add a Timer control to the form and name it Timer1. Set the Interval
property to 50.
- Add the following code to the Timer event of Timer1:
THISFORM.List1.ADDITEM("Red")
THISFORM.List1.ADDITEM("Green")
THISFORM.List1.ADDITEM("Blue")
THISFORM.List1.MULTISELECT = .T.
THISFORM.List1.SELECTED(2) = .T.
THISFORM.List1.SELECTED( 3 ) = .T.
THIS.INTERVAL = 0
THIS.ENABLED = .F.
- Run the form and note that both the second and third items are properly selected.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Visual FoxPro 6.0.
Modification Type: | Minor | Last Reviewed: | 3/3/2005 |
---|
Keywords: | kbBug kbfix kbvfp600fix kbXBase KB189505 |
---|
|