Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting the value of a listbox
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00521620
Message ID:
00521664
Views:
17
>>>George --
>>>
>>>That one sounds ripe for an access method %)
>>
>>Jay,
>>
>>Not a bad idea for single selection list box. Probably have to return a delimited string for mult-select.
>
>George --
>
>It's one of those things that I only write once for a control, but always have to think about... It would be simple to test for the type of the parameter, and pass back a delimited string if a DS of numbers were passed in.

Jay,

Sure something like this:
PROCEDURE SelectedItems_Access
  LOCAL lcresult, lni
  lcresult = ""
  WITH This
    IF .MultiSelect
      FOR lni = 1 TO .ListCount
        IF .Selected(lni)
          lcresult = lcresult + .List(lni) + ","
        ENDIF
      NEXT
      IF NOT EMPTY(lcresult)
        lcresult = LEFT(lcresult, LEN(lcresult) - 1)
      ENDIF
    ELSE
      IF .ListIndex > 0
        lcresult = .List(.ListIndex)
      ENDIF
    ENDIF
  ENDWITH
ENDPROC
? _SCREEN.ActiveForm.List1.SelectedItems
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform