Information générale
Titre:
Selecting listbox items in code - failing
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement