>>Has anyone ever had any problems setting a listbox item's selected property. I
>>know that you can programatically check if a listbox item is selected by
>>checking "this.selected[x]" for a logical...but when I try and set an item's
>>selected, it doesn't want to take. The VFP doc's say the property is read-
>>write so I'm at a loss...
>
>It is read-write...what code are you using to change it? I found that:
>
>thisform.list1.selected(3)=.t.
>
>selected the third item, no problem.
this is probably more code than you wanted to see but it resides in
the form.init with the "lstMultSelect" being the list box. In summary, this
listbox resides on a modal screen that is called from an "ON KEY" in a text field on another
screen in which the text field allows either alpha-numeric entry, or hitting the "ON KEY" that calls this screen to allow choosing from listbox instead.
I'm trying to check if there is any values already entered in the text field, and if so, highlighting those options when entering back into the modal screen by setting the "selected" property of the list item.
FOR xx = 1 to LEN(tcFldData)
lcChar = SUBSTR(tcFldData,xx,1)
FOR yy = 1 TO THIS.lstMultSelect.ListCount
lcTemp = THIS.lstMultSelect.List[yy]
lcTemp = LEFT(lcTemp, 1)
IF lcTemp = lcChar
***!*** THIS.lstMultSelect.Selected[yy] = .T.
EXIT
ENDIF
ENDFOR
ENDFOR
this.lstMultSelect.Refresh()
thanks again
Sean Campbell
www.upstagesoftware.comsc@upstagesoftware.com**********************************************************
Eddie, I wouldn't be anymore surprised, if tomorrow I woke up with my face stapled to the living room carpet.
Clark W. Griswold
**********************************************************