Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Messaging users within a network
Message
From
19/04/2003 09:04:02
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
To
18/04/2003 22:00:35
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00779263
Message ID:
00779477
Views:
21
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform