Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stuck! - guess I am thicker than I thought
Message
De
17/03/1997 23:20:40
 
 
À
17/03/1997 19:02:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00024589
Message ID:
00024606
Vues:
36
>Let me assure you that I have looked high and low and cannot find the answer to this.
>
>As I continue my journey towards OOP I have successfully written a small app. (menu and a few forms) using the VFP base classes and an OCX.
>Then I studied DataEnvironments, buffering and OOP concepts. I felt I was ready to define some classes and get a more solid OOP set-up for future use.
>
>An "application" object seemed like a sensible way to go, and I decided to use the Tasmanian Trader object as the basis for my own.
>But when I look at it (and the sub-classed TSTRADE object) I see some code in the Cleanup() method which I just don't get! Here is the code:
>
>****** CUT start *****
>
>LOCAL loForm
>
>THIS.lQuitting = .T.
>FOR EACH loForm IN application.Forms
> IF TYPE("loForm") == "O" AND loForm.Baseclass == "Form"
>
>****** CUT end *****
>
>The first thing which I cannot get is "... IN application.Forms" (third cut line).
>I do NOT see where "Forms" is defined in 'application'. And the VFP Application object does *not* have a Forms property.
>so the question is: What, where, how is Forms??
>
>The next thing which confused me was the first cut line: "LOCAL loForm".
>If loForm is local, and Cleanup is invoked without parameters, then the "FOR EACH loForm" does not make sense to me!
>- HOW can loForm have any EACHs when it is local?
>- HOW can loForm be 'IN application.Forms' if it is local?
>
>Seems I missed something very basic. Will anybody be kind enough to explain?
>
>Thanks in advance
>Jim N.


I can see where you can get confused. There are in reality, TWO application objects. 1) The object created from the custom class...in other words, the object created in TasTrades. 2) The "application" object defined by FoxPro itself. This object is always present in your program. If contains a "collection property" called Forms that is a list of all the open forms. Lookup the "Application Object" in Help. It should shed some light on the whole thing.

Craig
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform