Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Messaging users within a network
Message
De
19/04/2003 09:04:02
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
À
18/04/2003 22:00:35
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00779263
Message ID:
00779477
Vues:
20
>Not familiar with the CreateObject stuff. Is that heavy stuff Gerry?

The CREATEOBJECT and NEWOBJECT functions (and .AddObject and .NewOject methods)allow one to create (instantiate) objects in "code" vs dropping controls on forms.

For some classes (eg. Session), you can only create them in code so it is worth gaining some knowledge in that area.

If you need an object that doesn't need to be "extended" (ie. no extra method code), you simply create the object from its "base class"; eg. CREATEOBJECT( "Timer" ) and then explicitly set its properties via assignments.

If you need to extend the class, which is generally the case, you create a subclass of the base class and instantiate that. The subclass can be created "visually" as part of a VCX, or "in code" via DEFINE CLASS:
   t1 = CREATEOBJECT( "My_Timer" )

   = MESSAGEBOX( "Press ESC to CLEAR EVENTS" )

   ON KEY LABEL ESC CLEAR EVENTS
   READ EVENTS
   ON KEY LABEL ESC

DEFINE CLASS My_Timer AS Timer
   Interval = 5000              && 5 secs

PROCEDURE Timer
   THIS.Enabled = .F.

   = MESSAGEBOX( "Time has elapsed" )

   THIS.Reset()

   THIS.Enabled = .T.
ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform