Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom Property,Method
Message
De
10/01/2000 13:18:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00315611
Message ID:
00315620
Vues:
25
>I used to know how to do this two yrs ago, but I totally forgot.
>
>I want to create a custom property in my form, lets call it RATE.
>
>I want to be able to set it to a value in that form programatically.
>
>Then I want to be able to call a second modal form, from the first
>form, by clicking a command button. I want that second, modal form,
>in its INIT, to access the property of the first form, and then
>display that value in a textbox of the modal form.
>

Add the property Rate to the first form in design mode. (Form menu, New Property...).

>Lets call the first form ORDER. Lets call the modal second form
>ordersupp. Ordersupp should be able to access the value of that
>RATE property in the ORDER form, display it in a text box, allow the
>user to change it, and in the QUERYUNLOAD of the second form, it should be able to stuff that changed value BACK into the property
>of the first form.
>
>Please dont ask me WHY I want to do this, or tell me that I shouldnt
>do it, or that there are 27 other BETTER ways to accomplish something
>similar. I am simply trying to remember how properties, methods etc
>work between two different forms. What I am describing must be a
>do-able thing.
>
>

Modify the Init method of the second form to accept a parameter, and add a property to this second form. In the Init method, store the parameter into this new property.

Init (2nd form):
LPARAMETER toCallingForm
this.CalledBy = toCallingForm

Pass the object reference of the first form to the second form when it starts. I assume you're doing this from a button on the first form?

DO FORM ordersupp WITH thisform

Now, in the ordersupp form, you can reference the Order form's rate property like this:

thisform.CalledBy.Rate

Hope that helps.



>I am looking through WROX revolutionary guide to VFP oop, but havnt stumbled across what I need yet.
>
>thanks!
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform