Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Acopy() and myArray_assign()
Message
De
19/03/2004 12:28:05
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00887723
Message ID:
00887984
Vues:
13
Hi Sergey,
define class myClass as custom
  myArray(1,1) = ''

  procedure myArray_assign()
    LPARAMETERS vNewVal, m.nIndex1, m.nIndex2
    IF ISNULL(m.nIndex1)  && user didn't pass in a subscript
	THIS.myArray = m.vNewVal
    ELSE
	THIS.myArray[m.nIndex1, m.nIndex2] = m.vNewVal
    ENDIF

  procedure myMethod()
    local la(1)
    ..... create la(1,1) thru la( 5,2 )
    acopy( la, THIS.myArray )     && sends really screwed up nIndex1 and nIndex2 to _assign()

end define
I think I discovered my problem. I was creating myArray(1) instead of myArray(1,1). That only put m.nIndex1 as a lparameter in the assign(). I manually put in m.nIndex2 and it no longer crashed, but got really screwed up results when I acopy(). I just tried creating myArray(1,1) and acopy() seems to work now.
Correction: I just tried it, and I got the same screwy results.
Even though la(5,2), the lparameters passed to myArray_assign() are (1,2) (4,2) (6,2) (8,2) (10,2) (12,2) (14,2) (16,2) which triggers the crash.




BYW, do you think this is a bug?
define class myClass as custom
  myArray(1,1) = ''

  procedure myArray_access()
    LPARAMETERS m.nIndex1, m.nIndex2
    if empty( THIS.myArray(1) )
      ..... dimension array and fill in values
    endif
    RETURN THIS.myArray[m.nIndex1, m.nIndex2]
  
  procedure myMethod()
    if empty( this.myArray(1) )    && triggers myArray_access()
      ......
    endif
    if empty( this.myArray )       && DOES NOT trigger myArray_access()
      ......
    endif

end define
>Bill,
>
>It's not clear what you're doing. Can you post your code?
>
>>I'm using VFP 7.0
>>
>>If I create an array [ myArray(n,n) ] with an assign() method, how do I "acopy(some_array,this.myArray)" ?
>>
>>I've figured out that I have to add a parameter to the _assign() code, but it doesn't work. I've traced it, and the acopy() doesn't pass the correct parameters.
>>
>>TIA
Bill Morris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform