Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox invert problem
Message
From
10/01/2005 15:55:54
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/01/2005 14:26:45
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00975756
Message ID:
00975793
Views:
16
>I have added the following method to my listbox. It is designed to select all or none, or invert the selection only when the listbox is set for MultiSelect. All and none work just fine. Invert on the other hand does not. When I pass that parameter into the method, the method selects all.
>
>Any thoughts?
>
>Thanks for you help.
>
>
>LPARAMETERS pcSelectionType
>
>** parameter and property check
>IF VARTYPE(pcSelectionType) # "C" OR !this.MultiSelect
>    RETURN
>ENDIF
>
>LOCAL llSelectionState, lnThisItem
>
>vNewVal = UPPER(vNewVal)
>DO CASE
>    CASE pcSelectionType = "ALL"
>        llSelectionState = .T.
>    CASE pcSelectionType = "NONE"
>        llSelectionState = .F.
>    CASE pcSelectionType = "INVERT"
>        llSelectionState = .NULL.
>    OTHERWISE
>        RETURN
>ENDCASE
>
>** do this or nothing will be selected
>this.SetFocus()
>
>FOR lnThisItem = 1 TO this.ListCount
>    this.Selected(lnThisItem) = IIF(ISNULL(llSelectionState), !this.Selected(lnThisItem), llSelectionState)
>ENDFOR
>
>
Would this do?
Lparameters pcSelectionType

** parameter and property check
If Vartype(pcSelectionType) # "C" Or !This.MultiSelect
    Return
Endif

Local lnThisItem
With This
    For lnThisItem = 1 To .ListCount
        .Selected(m.lnThisItem) = ( m.pcSelectionType = "ALL" Or ;
            (m.pcSelectionType = "INVERT" And !.Selected(m.lnThisItem)))
    Endfor
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform