|
Home > Archive > FoxPro Help and Support > May 2005 > create a custom class with its own session
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
create a custom class with its own session
|
|
| D.Rudiani 2005-05-17, 8:25 pm |
| i would like to create a custom class, but this should have its own session.
I do not want to use the prg to create a class based on the session class
(as i hate using PRG files).
& tis easier to use the custom class (easy to view methods, add properties,
etc).
I tried to create a class oTest based on the session class in a prg file.
Define Class oTest as Session
EndDefine
& then tried to create a custom class based on the above class, but only to
get an error saying that this wasn't a table.
Any ideas?
| |
| Fred Taylor 2005-05-17, 8:25 pm |
| You can't create a different type of class of off separate base classes.
Also, Session classes can't be in a .VCX class library.
As long as your DEFINE CLASS .PRG is current, or is used in a SET PROCEDURE
TO, the create object should be able to find it. In your example, to create
a class off of that (still can't be in a .VCX):
DEFINE CLASS mynewtest AS oTest
..
..
..
ENDDEFINE
This class will now be a session class, same as oTest and inherit any
properties or methods you define in oTest. You can then use CREATEOBJECT()
to create an instance of either the oTest class, or the mynewtest class. You
can also use the NEWOBJECT() function if you don't want to have a SET
PROCEDURE to the .PRG with the DEFINE CLASSes in it.
--
Fred
Microsoft Visual FoxPro MVP
"D.Rudiani" <rudi@www.com> wrote in message
news:e6WLTG0WFHA.3864@TK2MSFTNGP10.phx.gbl...
>i would like to create a custom class, but this should have its own
>session.
> I do not want to use the prg to create a class based on the session class
> (as i hate using PRG files).
> & tis easier to use the custom class (easy to view methods, add
> properties,
> etc).
>
> I tried to create a class oTest based on the session class in a prg file.
> Define Class oTest as Session
> EndDefine
>
> & then tried to create a custom class based on the above class, but only
> to
> get an error saying that this wasn't a table.
>
> Any ideas?
>
>
| |
| Anders Altberg 2005-05-18, 7:25 am |
| The Form object has a DataSession property.
You can use the Class Browser to make a Custom class. Save the output from
'View Class Code' and change AS Custom to AS Session.
-Anders
"D.Rudiani" <rudi@www.com> wrote in message
news:e6WLTG0WFHA.3864@TK2MSFTNGP10.phx.gbl...
> i would like to create a custom class, but this should have its own
session.
> I do not want to use the prg to create a class based on the session class
> (as i hate using PRG files).
> & tis easier to use the custom class (easy to view methods, add
properties,
> etc).
>
> I tried to create a class oTest based on the session class in a prg file.
> Define Class oTest as Session
> EndDefine
>
> & then tried to create a custom class based on the above class, but only
to
> get an error saying that this wasn't a table.
>
> Any ideas?
>
>
|
|
|
|
|