Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issue, new PEMSTATUS for hidden native properties
Message
De
24/11/2004 08:07:01
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
Issue, new PEMSTATUS for hidden native properties
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00964227
Message ID:
00964227
Vues:
79
Previous issue Thread #963870

Bug/Issue : 15 of 36

TITLE: Issue, new PEMSTATUS for hidden native properties

VERSION: 09.00.0000.1720 and VFP8SP1

EXPECTED: PEMSTATUS(,PEM_DEFINED) it must return the defined status, as it happened in VFP8.

OBSERVED: the new way to operate of PEMSTATUS(, PEM_DEFINED) put its use uncertain,
because the information that returns is not sure.

EXPLAIN: this is a patch for a present problem in the previous versions,
but this patch creates more problems than those that resolves.

On VFP8 when
PEM_DEFINED
returns:
False	I can say with certainty that the property is not defined and that he is not readable.
        defined info 100%,    readable info 100%
True	I can say with certainty that the property is defined, but do not know if it is readable.
         defined info 100%,   readable info   0%
On VFP9 when
PEM_DEFINED
returns:
False	I can say with certainty that the property is not readable, but do not known if it is defined.
        defined info 0%,   readable info 100%
True	I can say with certainty that the property is defined, but do not know if it is readable.
        defined info 100%, readable info      0%
On VFP9 I can remove the uncertainty only if I know with certainty that the property is native or not.
This implies that the code must know if the property is native or not,
If the code is generic, i have to write code in order to known this fact:
property parameter is native or is not native ( this is the problem )

To this point, he is simpler and express to use a TYPE() or,
if it comes resolved the bug, the faster VARTYPE() that return "U".

BUT this not solve another question:
can I define this property ?
On VFP8, with
PEM_DEFINED
i known this with a command,
but on VFP9 i have to try and catch the error!

Completely mistaken.

I hope someone of the VFPT see again the matter.
In the below code I have brought back one reasonable solution.

REPRO code with comments:
CLEAR
*-- PEMSTATUS Attribute
#DEFINE PEM_CHANGED		0
#DEFINE PEM_READ_ONLY		1
#DEFINE PEM_PROTECTED		2
#DEFINE PEM_TYPE		3
#DEFINE PEM_USER_DEFINED	4
#DEFINE PEM_DEFINED		5
#DEFINE PEM_INHERITED		6

aso = CREATEOBJECT("subClass1")
* now, can i control a hidden property
* for a baseclass hidden property
IF PEMSTATUS(m.aso,"Width",PEM_DEFINED)		&& this have to return .T., becuse width it is defined but hidden
	IF !PEMSTATUS(m.aso,"pippo",PEM_PROTECTED)
		=m.aso.Width			&& on VFP8 i have a error here
	ENDIF
ELSE
	aso.AddProperty("Width",99)		&& on VFP9 i have a error here
ENDIF
* for a class hidden property
IF PEMSTATUS(m.aso,"pippo",PEM_DEFINED)
	IF !PEMSTATUS(m.aso,"pippo",PEM_PROTECTED)
		=m.aso.pippo			&& on VFP8 AND VFP9 i have a error here
	ENDIF
ELSE
	aso.AddProperty("pippo",.T.)
ENDIF
* for a class protected property i can control my work
IF PEMSTATUS(m.aso,"prisco",PEM_DEFINED)
	IF !PEMSTATUS(m.aso,"prisco",PEM_PROTECTED)
		=m.aso.prisco			&& on VFP8 AND VFP9 i have a error here
	ENDIF
ELSE
	aso.AddProperty("prisco",.T.)
ENDIF	
RETURN
* my solution:
* add 

#DEFINE PEM_READABLE	7 && for not defined,hidden return .F., for protected retun .F. on a object

* WITH THIS I CAN WRITE:
DO CASE
	CASE PEMSTATUS(m.aso,"pName",PEM_READABLE)
		=m.aso.pName
	CASE !PEMSTATUS(m.aso,"pName",PEM_DEFINED)	&& this require a rollback for the new VFP9 behaviour
		aso.AddProperty("pName",.T.)
	CASE PEMSTATUS(m.aso,"pName",PEM_PROTECTED)
		* control the protected property
	OTHERWISE
		* control the hidden property
ENDCASE

DEFINE CLASS subClass1 AS Cursor
	HIDDEN pippo
	PROTECTED prisco
ENDDEFINE
Fabio
Répondre
Fil
Voir

Click here to load this message in the networking platform