Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loopin a variable length array
Message
De
22/02/1999 01:32:48
 
 
À
22/02/1999 00:31:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00189697
Message ID:
00189886
Vues:
11
>Treat the array as a LIFO stack:
>
do while !isnull(this.ToDoObjects[1])
>    lnTopOfStack = alen(this.ToDoObjects)
>    loCurrent = this.ToDoObjects[lnTopOfStack]
>    loTopOfStack = lnTopOfStack - 1
>    if lnTopOfStack = 0
>        this.todo[1] = null
>    else
>        dimension this.ToDoObjects[lnTopOfStack]
>    endif
>    * do whatever with loCurrent
>enddo
></pre
>If you don't want to constantly redimension the array, create and maintain a corresponding ToDoObjectCount property.

Hi Albert,

This is very good!  Something like<PRE>

*-- .aCalcBuffer is the array that contains references to controls requiring
*   notice of a value change.
*   
*   .aCalcBuffer[x,1]  - A reference to the control whose value has changed
*   .aCalcBuffer[x,2]  - the new value
*   .aCalcBuffer[x,3]  - A reference to the control requesting notice of the
*       change
*
WITH this
    DO WHILE .T.
        IF TYPE(.aCalcBuffer[1,3]) = "O"
           IF PEMSTATUS(.aCalcBuffer[1,3],"ReceiveValueChange",5)
             *   If the control requesting notice of the change has a
             *   ReceiveValueChange() method, and can thus process the notice
             *   of change, send a reference to the control whose value has
             *   changed and the new value to the control requesting notice 
             *   of the change
             .aCalcBuffer[1,3].ReceiveValueChange(;
                      .aCalcBuffer[1,1],.aCalcBuffer[1,2])
           ENDIF
        ENDIF
        IF ALEN(aCalcBuffer) > 1
            *-- Delete the element just sent...
            ADEL(.aCalcBuffer,1)
            *-- and redimension the array
            DIMENSION .aCalcBuffer(ALEN(.aCalcBuffer))
        ELSE
            .aCalcBuffer = .NULL.
            EXIT
        ENDIF
    ENDDO
ENDWITH
Thanks,

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform