Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
No Parameter Statement passing Form Array Values?
Message
De
22/09/1999 11:15:49
Bob Lucas
The WordWare Agency
Alberta, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00267425
Message ID:
00267596
Vues:
26
I have found a very useful method is to use a custom 'parameter' object for passing array information.

I don't have my code but I believe the class is defined as such:

DEFINE CLASS formparms AS custom


Name = "formparms"
DIMENSION acdata[1,1]


PROCEDURE Init
LPARAMETER tnsize

DIMENSION this.acdata[tnsize]
ENDPROC


ENDDEFINE

When I do a createobject for this class, I pass in the size of the array I want.

So your code would be changed to this:

ox = Createobject("formparms", 5)
ox.acdata[1] = 200 && Height
ox.acdata[2] = 260 && Width
ox.acdata[3] = 290 && Left
ox.acdata[4] = 70 && Top
ox.acdata[5] = ThisForm.txtPick.Value
do form UserChild with ox

The reason I do this is because in a lot of cases I want some return values from the modal form. I use it for forms that ask for date ranges etc. or other parameters before printing a report.

This method is very quick, easy and flexible and avoids some of the issues of passing arrays to functions. As well it is more 'Object Oriented'!



>Earlier post was not accurate in the code, here it is.
>
>I have a form with a 5-element array in it. I would like to pass this to a modal child form and use the elements in the array to resize the child form.
>
>So in the click event of the parent form's button, I have:
>dimension arFormSpec[5]
>arFormSpec = ''
>arFormSpec[1] = 200 && Height
>arFormSpec[2] = 260 && Width
>arFormSpec[3] = 290 && Left
>arFormSpec[4] = 70 && Top
>arFormSpec[5] = ThisForm.txtPick.Value
>do form UserChild with arFormSpec
>
>And then I made a form property on the child modal form called
>arFormSpec[5]
>
>And in the init method of the form I have
>ThisForm.Height = arFormSpec[1]
>
>But when I run the parent form I get an error - NO PARAMETER STATEMENT IS FOUND
>
>What did I miss?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform