Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create Single COMMON class that exists in 10 classes
Message
De
17/02/2009 12:55:20
 
 
À
17/02/2009 12:33:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Divers
Thread ID:
01382376
Message ID:
01382421
Vues:
63
>Hi Greg
>
>Thank for the code.
>
>I guess I should ask my question in it is exact situation.
>
> I am building my frame, in which i am trying to use something like
>
>
>Numbers = CreateObject("Numbers")
>Numbers.Convert.HexToDec("FFF")
>SQL  = CreateObject("MSSQL")
>SQL.SQL2000.Server="Myserver"
>SQL.SQL2005.Connection.Authenticate = "Local"
>
>

It sounds like, rather than adding references to these classes to each of your other classes, you should add references to these classes to a single application object, which all the objects in your framework can talk to as needed:
* In your main program
PRIVATE goApp

goApp = CREATEOBJECT("YourApplication")


* Somewhere accessible
DEFINE CLASS YourApplication AS Custom 

oNumbers = .null.
oSQL = .null.
* etc.

PROCEDURE Init

This.oNumbers = CREATEOBJECT("Numbers")
This.oSQL  = CreateObject("MSSQL")
IF NOT IsNull(This.oSQL)
   This.oSQL.SQL2000.Server="Myserver"
   This.oSQL.SQL2005.Connection.Authenticate = "Local"
   * etc.
ENDIF

RETURN

* Other operations needed throughout your application as methods

ENDDEFINE
Then, elsewhere in your application, you can call on these objects:

goApp.oNumbers....

or

goApp.oSQL....

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform