Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi-selecting Prob w/ listbox with rowsource = 6 (Fiel
Message
From
07/07/2005 13:02:42
Diran Nazarian
Alion Science and Technology
Annapolis, Maryland, United States
 
 
To
07/07/2005 12:56:58
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01030030
Message ID:
01030038
Views:
16
I've tried that, and when I debug the gotfocus event it restores my items as expected. But once the gotfocus event is finished it deselects the items I restored and randomly selects items that it wants to.

Here is my lostfocus and gotfocus code.

LOSTFOCUS event:
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

ENDFOR
GOTFOCUS 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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform