LOCAL lc_indexno LOCAL ln_loop lc_indexno = "" FOR ln_loop = 1 TO THIS.LISTCOUNT IF THIS.SELECTED(ln_loop) lc_indexno = ALLTRIM(STR(ln_loop)) THISFORM.rc_selected = ALLTRIM(THISFORM.rc_selected) + lc_indexno + "," ENDIF ENDFORGOTFOCUS event:
LOCAL ln_pos LOCAL lc_item LOCAL ln_strlen LOCAL lc_newstring LOCAL ln_clrcnt LOCAL ln_loop lc_main = THISFORM.rc_selected lc_new = lc_main ln_strlen = LEN(lc_new) *!* Clear the list of any selected items. FOR ln_clrcnt = 1 TO THIS.LISTCOUNT THIS.SELECTED(ln_clrcnt) = .F. ENDFOR *!* Select the items that the user chose before losing focus. DO WHILE ln_strlen > 0 ln_pos = AT(",",lc_new) IF ln_pos >1 lc_item = SUBSTR(lc_new,1,ln_pos-1) THIS.SELECTED(VAL(lc_item)) = .T. lc_new = SUBSTR(lc_new,ln_pos+1) ln_strlen = LEN(lc_new) ENDIF ENDDO *!* reset the selected property value. THISFORM.rc_selected = ""rc_selected is a Form property I created.