Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hidden Property Not Found in Base Class with DODEFAULT()
Message
De
06/03/2002 09:14:13
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00628708
Message ID:
00628955
Vues:
13
Jim -- Thanks for trying that...

Here is some "test" code that demonstrates the problem I am having. I have included the base class and the subclass. This is the code that causes the problem when there is a dodefault() in the INIT. If you remove all code from the INIT the subclass works fine. Also, if you run this in 6.0 with code in the INIT it also works.

It seems that in 7.0 the DODEFAULT() must actually make a "call" to the INIT event which makes sense that the hidden property shouldn't be visible. But that would then mean that you could never have a hidden property in any class that could be subclassed and modified with the need to use a DODEFAULT(). Just doesn't seem right.

I know that I can make the property protected and it would work, but that seems to defeat the purpose of the hidden feature...

Thanks--Marian


**************************************************
*-- Class: testclass (c:\classt\testit.vcx)
*-- ParentClass: custom
*-- BaseClass: custom
*-- Time Stamp: 03/06/02 08:51:11 AM
*
DEFINE CLASS testclass AS custom


HIDDEN hiddenprop
hiddenprop = "hidden property"
Name = "testclass"


PROCEDURE hiddenprop_access
*To do: Modify this routine for the Access method
RETURN THIS.hiddenprop

ENDPROC


PROCEDURE hiddenprop_assign
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
THIS.hiddenprop = m.vNewVal
ENDPROC


PROCEDURE Init
x = this.hiddenprop
WAIT WINDOW "This is the value of x" + x
ENDPROC


PROCEDURE Destroy
WAIT WINDOW "destroy event"
ENDPROC


ENDDEFINE
*
*-- EndDefine: testclass
**************************************************


**************************************************
*-- Class: subtest (c:\classt\testit.vcx)
*-- ParentClass: testclass (c:\classt\testit.vcx)
*-- BaseClass: custom
*-- Time Stamp: 03/06/02 08:58:04 AM
*
DEFINE CLASS subtest AS testclass


Name = "subtest"


PROCEDURE subclassmethod
WAIT WINDOW "SubClassMethod"
ENDPROC


PROCEDURE Init
DODEFAULT()

WAIT WINDOW "INIT"
ENDPROC


ENDDEFINE
*
*-- EndDefine: subtest
**************************************************


***************************************************
*-- Program to run code above
SET CLASSLIB TO c:\classt\testit additive
loPolicyInfo = NEWOBJECT("subtest", "c:\classt\testit.vcx")
IF VARTYPE(loPolicyInfo) = "O" AND NOT ISNULL(loPolicyInfo)
loPolicyInfo.subclassmethod()
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform