Joe,
You can simply include your class in a .prg e.g "Classes.prg and include it
in the project (or not if you want to dynamically change it). 

To add the class definitions into the code which VFP searches for the
definition do:

set procedure to classes additive

The "additive" clause ensures that you keep any other "set Proc..."
definitions such as "set procedure to subroutines" which may have been
issued earlier.

Then you can simply issue a createObject or a NewObject for the class

oObj=CreateObject("clsMyClass") 
or
oObj=NewObject("clsMyClass","Classes.prg") 

Note that with NewObject() you can define where the class definition is
held, which can be a .prg or .vcx file. The advantage of this method is that
you don't need the "set procedure to..." which you do with the CreateObject
method but you DO need to make sure the class definition is in the VFP Path
(set path to....)

Dave Crozier



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Joe Yoder
Sent: 25 September 2007 16:44
To: [email protected]
Subject: How do I use a class defined in a .prg in a project

Classes and objects are new to me so forgive me for asking beginner
questions.  Feel free to point me to the appropriate point in the help
system if that is what I need.  One of the problems I have as a newbe is
knowing the proper terms to use - this makes finding help more difficult.
 
I have a code example from News2News.com that allows me to ping from VFP.  I
need to include this code in a project where I use the graphical design
tools.  Do I need to convert the [class in a .prg]  to a visual class and
put it into a library?  If so - how do I do that?
 
TIA - Joe


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to