Hi Guys,
There must be a "gotcha" in this that's really gettin' me. I need to programmatically pre-select 2-5 members of a group of about 20 default choices in a MultiSelect ListBox. If the following code is placed in the INIT of the multiselect list, it fails. But if it is placed in the CLICK of a CommandButton it works just fine (after the Form is constructed and visible).
The failed result appears as a dotted line drawn around only the last member of the default list (in this example, 7); no highlights; all list members test False on Selected().
The normal result (done by CommandButton code) highlights all defaults correctly.
I have tried: 1) Placing code in the Form.Init event (to fire later); 2) Setting focus to both off and on the ListBox before running the default code. Neither works; 3) Setting ScreenLock .T. Nada for all of these tries.
What am I missing here?
TIA
There must be a "gotcha" in this that's really gettin' me. I need to programmatically pre-select 2-5 members of a group of about 20 default choices in a MultiSelect ListBox. If the following code is placed in the INIT of the multiselect list, it fails. But if it is placed in the CLICK of a CommandButton it works just fine (after the Form is constructed and visible).
Code:
WITH THISFORM.list1
FOR i = 1 TO .LISTCOUNT
IF INLIST(i,1,2,4,7)
.SELECTED(i) = .T.
ENDIF
NEXT
ENDWITH
The normal result (done by CommandButton code) highlights all defaults correctly.
I have tried: 1) Placing code in the Form.Init event (to fire later); 2) Setting focus to both off and on the ListBox before running the default code. Neither works; 3) Setting ScreenLock .T. Nada for all of these tries.
What am I missing here?
TIA