Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Working with the collection class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01017111
Message ID:
01017217
Vues:
33
>Nadya,
>
>Thanks for the additional info. I understand a bit more now as to what you're trying to do. The bad news is, a solution won't be pretty. The problem is that your collection is of class names, not object references. The Keys to correspond to the control names and could be EVALUATED() out to get a reference, though. I can only think to two options for you (and I'm not crazy about either of them).
>
>1) Create a sort method that iterates through the collection, EVALUATES() reference objects to the controls, gets their tab order, and store the tab order, collection value, and collection key to an array. Sort the array. Clear the collection. Rebuild the collection by iterating through the array and thereby building the collection in the proper order. I know you don't really want to do that one.
>
>2) Instead of using SetAll(), iterate through the Objects collection of the form storing the control and control.tabindex to an array. Sort the array by tabindex. Iterate through the array and set the lRegister to true. Like I said, not pretty, but it would work. Something like this:
>
>LOCAL ARRAY laObject[1, 2]
>LOCAL lnRow AS Integer, ;
>      lnX AS Integer, ;
>      loObj AS Object
>
>lnRow = 0
>
>FOR lnX = 1 TO thisform.Objects.Count
>  loObj = thisform.Objects[lnX]
>  IF PEMSTATUS(loObj, 'lRegister' 5) AND PEMSTATUS(loObj, 'TabIndex', 5)
>    lnRow = lnRow + 1
>
>    IF lnRow > ALEN(laObject, 1)
>      DIMENSION laObject[lnRow, 2]
>    ENDIF
>
>    laObject[lnRow, 1] = loObj.TabIndex
>    laObject[lnRow, 2] = loObj
>  ENDIF
>ENDFOR
>
>ASORT(laObject, 1)
>
>FOR lnX = 1 TO ALEN(laObject, 1)
>  loObj = laObject[lnX, 2]
>  loObj.lRegister = .t.
>ENDFOR
>
>HTH,
>Chad
>
I wish I read your message before. For some unknown reason I didn't, otherwise I would code it a little bit differently. Let me recode, because your code is more elegant, than mine, though we both used the same idea.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform