Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql in listbox
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00410230
Message ID:
00410282
Vues:
17
>>>Hello, I am having a problem with a listbox click event returning the value of what is in the clicked item. I have rowsource as a select statmentand rowsourcetype as sql. It always returns the first record though. :(
>>\
>So it's a manual thing? I have to provide my own code to capture the value of what was clicked on?

For multilists, the answer is Yes. For normal listbox with single selection I'm not so sure. Check ListIndex property and all other properties for ListBox in Help.

>
>
>
>>This is from my btcc_multilist.ItemList() code, which reconstructs a comma-delimited list of selected items:
>>
>>********************************************************************
>>*  Description.......: BTCC_MultiList.BTC_ItemList: method to return a comma-delimited list of the selected items
>>*  Calling Samples...:
>>*  Parameter List....:
>>*  Created by........: MDA
>>*  Modified by.......: Nadya Nosonovsky 12/29/1999 04:20:21 PM
>>********************************************************************
>>* 11/26/99 NN added into this method an ability to populate btcselarray
>>* 12/14/99 NN added AllSelected property
>>
>>* Returns a comma-delimited list of quoted codes corresponding to those selected.
>>* If none, returns the empty string.
>>local result, n, k, lnSel, lnLen
>>
>>* check for empty array special case
>>if alen(this.btcvalarray) && array is empty
>>     return ''                                   && null list result
>>endif
>>
>>result = ''                                        && start with nothing
>>k=0
>>lnSel=0
>>
>>with this
>>
>>     lnLen=alen(.btcvalarray, 1)
>>* loop over the array, building list of selected codes
>>     for n = 1 to lnLen                    && cycle over rows
>>          if .Container1.List1.selected(m.n)               && this item is selected
>>               lnSel=lnSel+1 && increment count of selected items
>>               if k>=1 and ascan(.btcselarray, .btcvalarray[m.n, 2])>0 && This code already exists
>>* Do nothing
>>               else
>>                    result = m.result + iif(empty(m.result), '', ',') ;
>>                         + '"' + .btcvalarray[m.n, 2] + '"'     && tack on another code
>>                    k=k+1
>>                    dimension .btcselarray[k] && redim array
>>                    .btcselarray[m.k]= .btcvalarray[m.n,2]
>>               endif
>>          endif
>>     endfor
>>
>>     .btccrit=m.result && store in a property
>>
>>     if lnSel=lnLen and not .ExcludeFlag && All selected and don't need to be excluded
>>          .AllSelected=.t.
>>          m.result='' && empty criterion
>>     else
>>          .AllSelected=.f.
>>     endif
>>endwith
>>return m.result                                   && done - return list of selected codes
>>
>>HTH
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform