Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting listbox items in code - failing
Message
From
29/07/1998 16:02:11
Tim Hockin
Illinois State U - Residential Computing
Normal, Illinois, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Selecting listbox items in code - failing
Miscellaneous
Thread ID:
00122468
Message ID:
00122468
Views:
45
I am attempting to select a few items in a multi-select listbox at start up, showing the user which records exist. However, I have a few problems.

in listbox.init() or form.init() (neither works) I have

*****************************************
SELECT ValidFacil
COUNT TO lnCount

DIMENSION laList[lnCount]

* figure out the current list of halls
SELECT Rooms
lnCount = 1
SCAN FOR Rooms.RateSheetNum == THISFORM.RateNum
IF (ASCAN(laList, ALLTRIM(Rooms.Hallname)) == 0)
laList[lnCount] = ALLTRIM(Rooms.Hallname)
lnCount = lnCount + 1
ENDIF
ENDSCAN

* loop thru the listbox, select correct halls
IF THISFORM.lstHalls.ListCount > 0
FOR lnCount = 1 TO THISFORM.lstHalls.ListCount
IF (ASCAN(laList, THISFORM.lstHalls.List[lnCount]) > 0)
THISFORM.lstHalls.Selected[lnCount] = .T.
ENDIF
ENDFOR
ENDIF
*****************************************

The records do NOT get selected.
If I put this in a button.click and run it, it works, until the listbox receives a paint() event (e.g. - I scroll it) and the record selections disappear again.

What I need is for it to behave as if the user selected these records.

Am I missing something, or is there a known workaround? something?

Tim
Next
Reply
Map
View

Click here to load this message in the networking platform