Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pemstatus vs amembers
Message
From
30/11/2010 06:48:00
 
 
To
30/11/2010 06:43:05
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01491017
Message ID:
01491063
Views:
50
with hidden and protected:
- pemstatus(,5) should return false
- ADDPROPERTY should return false, not an error
- VARTYPE() should return "U", not an error

>Hi Fabio
>
>while the VARTYPE error is a problem, the ADDPROPERTY is not realy a bug. If you extend your example
>
>CLEAR
>
>PUBLIC OX
>OX = CREATEOBJECT("z")
>
>? PEMSTATUS(ox,"NPROP",5)
>? PEMSTATUS(ox,"PPROP",5)  && add PEMS(,,2)
>? PEMSTATUS(ox,"HPROP",5)  && add PEMS(,2) and TYPE()
>
>ADDPROPERTY(OX,"NPROP",7) && OK
>ADDPROPERTY(OX,"PPROP",7) && ERROR 
>ADDPROPERTY(OX,"HPROP",7) && ERROR 
>
>
>OX.NPROP=7 && OK
>OX.PPROP=7 && ERROR 
>OX.HPROP=7 && ERROR 
>
>? VARTYPE(ox.NPROP)!='U' && OK
>? VARTYPE(ox.XPROP)!='U' && OK
>? VARTYPE(ox.PPROP)!='U' && ERROR
>? VARTYPE(ox.HPROP)!='U' && ERROR
>
>DEFINE CLASS z as "textbox"
>	HIDDEN 		HPROP
>	PROTECTED 	PPROP
>	
>	HPROP = 1
>	PPROP = 2
>	NPROP = 3
>ENDDEFINE
>
>
>you see that the assignment raises the same error as ADDPROPERTY (o.k the error is misleading, but in TP3.0 it would be "Syntax error or pointer not defined")
>
>Agnes
>
>>>I have a program that checks to see if a property already exists on an object before adding it, which would be the better way to determine if the property already exists?
>>>
>>>
>>>    AMEMBERS( m.laPropertySet, m.loMyObject )
>>>    IF ASCAN(m.laPropertySet,[cNewProperty],1,0,1,1)>0 && Case insensitive search, 0-not found
>>>      ADDPROPERTY( m.loMyObject, [cNewProperty], [Test Information])
>>>    ENDIF
>>>    
>>>    && or should I do this instead:
>>>    
>>>    IF PEMSTATUS( m.loMyObject, [cNewProperty], 5)
>>>      ADDPROPERTY( m.loMyObject, [cNewProperty], [Test Information])
>>>    ENDIF
>>>
>>>
>>>What do you think?
>>
>>PEMSTATUS() without delay.
>>is made for this
>>is the most flexible
>>is the fastest
>>
>>Attention with protected and hidden property, a bug exist
>>
>>
>>CLEAR
>>
>>PUBLIC OX
>>OX = CREATEOBJECT("z")
>>
>>? PEMSTATUS(ox,"NPROP",5)
>>? PEMSTATUS(ox,"PPROP",5)  && add PEMS(,,2)
>>? PEMSTATUS(ox,"HPROP",5)  && add PEMS(,2) and TYPE()
>>
>>ADDPROPERTY(OX,"NPROP",7) && OK
>>ADDPROPERTY(OX,"PPROP",7) && ERROR 
>>ADDPROPERTY(OX,"HPROP",7) && ERROR 
>>
>>? VARTYPE(ox.NPROP)!='U' && OK
>>? VARTYPE(ox.XPROP)!='U' && OK
>>? VARTYPE(ox.PPROP)!='U' && ERROR
>>? VARTYPE(ox.HPROP)!='U' && ERROR
>>
>>DEFINE CLASS z as "textbox"
>>	HIDDEN 		HPROP
>>	PROTECTED 	PPROP
>>	
>>	HPROP = 1
>>	PPROP = 2
>>	NPROP = 3
>>ENDDEFINE
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform