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
>Chad,
>
>Good questions.
>
>I add objects (containers to be presize) into my collection. I use NamedSearch as the key and this I can not change, because I use it in many places.
>
>Now, how may I ensure, that my colleaction has containers added in the order of their TabOrder? I want to avoid iterating through collection if I may add my containers the right way in the beginning.
>
>Here is a trick I use to add objects to the collection:
>I have a property of the container called lRegister with the assign method. In that method I do:
_________________________________
There are 2 types of people in the world: