Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a form's objects from an external program
Message
 
 
À
07/12/1997 20:42:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00064373
Message ID:
00064381
Vues:
38
John,

It's kind of hazardous to rely on a particular name of an object, it makes your code much less reuseable. You are much better off sending the external program a reference to the Form, or the object that it should communicate with, then the program can just send a message to that object via the reference without knowing it's name. For example in the Click of a button that calls the external program:

   TheUDF( thisform, this )


In the UDF:
   lparameter oForm, oButton
   oForm.BackColor = 255
   oButton.Caption = "I'm in control now"


You might also want to determine if you want such a close coupling or the UDF and the form, ie how much should the UDF know about the internals of the form? A lot of OO people will say "It should know nothing!" you should instead call a method of the form and let the form deal with it's internal objects. I agree with this design philosophy, but in some cases you may want to break that rule, as long as you know why you are breaking it, and it's documented so others that come after you will know what's going on.

>Developing in VFP 3.0, I have a form that calls an external program to do tellecommunications. I need the program to update objects on the calling form. The form's scx file is "import". I reference the objects on the form using its variable like: "import.shape1.backcolor=". Foxpro returns the object import not found. What am I doing wrong?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform