Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug, Vartype error with hidden and protected properties
Message
 
To
23/11/2004 13:34:30
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00963870
Message ID:
00963991
Views:
7
Fabio,

OK, You are right.
(But these bugs are in VFP 6.0...)

MartinJ

>>Hi Fabio,
>>
>>I don't see why is it bug...
>>
>>WITH CREATEOBJECT('aaax')
>>   ?"Object:"
>>   ?"hidden", VARTYPE(.hprop)
>>   ?"protected", VARTYPE(.pprop)
>>   ?"normal", VARTYPE(.prop)
>>   ?"unknown", VARTYPE(.propx)
>>   ?
>>   .Test()
>>   ?
>>   .Test2()
>>ENDWITH
>>
>>DEFINE CLASS aaa as Custom
>>HIDDEN hprop
>>PROTECTED pprop
>>hprop = .T.
>>pprop = .T.
>>prop = .T.
>> procedure test()
>>   ?"First class:"
>>   ?"hidden", VARTYPE(.hprop)
>>   ?"protected", VARTYPE(.pprop)
>>   ?"normal", VARTYPE(.prop)
>>   ?"unknown", VARTYPE(.propx)
>> endproc
>>
>>ENDDEFINE
>>
>>
>>DEFINE CLASS aaax as aaa
>> procedure test2()
>>   ?"Derived class:"
>>   ?"hidden", VARTYPE(.hprop)
>>   ?"protected", VARTYPE(.pprop)
>>   ?"normal", VARTYPE(.prop)
>>   ?"unknown", VARTYPE(.propx)
>> endproc
>>
>>ENDDEFINE
>>
>>
>>- Object cannot r/w hidden/protected properties and call hidden/protected methods
>>- Derived class cannot r/w hidden properties and call hidden methods from class hierarchy
>
>Correct, but i can write:
>- Object cannot r/w undefined properties and call undefined methods
>
>and with this case, VARTYPE() return "U".
>
>The function VARTYPE() Returns the data type of an expression.
>with this definition the correct syntax it is EXPTYPE(),
>or i can interpreter it like:
>which data type assumes a variable one that takes the value of the expression?
>
>However you see it,
>if VARTYPE() cannot estimate the expression, must give back "U";
>must give back a error if the expression has one wrong syntax:
>example:
>
>VARTYPE(1+'a')
>
>
>Another proof of the bug it is:
>for a out of scope defined variable, VARTYPE() return "U" corretìctly.
>
>*  But A out of scope  variable it is a hidden var
>definedVar = 4
>innerScope(@definedVar)
>PROCEDURE innerScope(refVar)
>  ? VARTYPE(m.definedVar)
>ENDPROC
>
>
>I guess the cause, observe this correlation:
>PEMSTATUS(.class,".xxxx",5),VARTYPE(.xxx)
>
>clear
>WITH CREATEOBJECT('aaa')
>   ?"Object:"
>   ?"hidden"	,PEMSTATUS(.class,"hprop",5)	,VARTYPE(.hprop)	&& readable N, defined Y => vartype error
>   ?"protected"	,PEMSTATUS(.class,"pprop",5)	,VARTYPE(.pprop)	&& readable N, defined Y => vartype error
>   ?"normal"	,PEMSTATUS(.class,"prop",5)	,VARTYPE(.prop)		&& readable Y, defined Y => vartype NO error
>   ?"unknown"	,PEMSTATUS(.class,"propx",5)	,VARTYPE(.propx)	&& readable N, defined N => vartype NO error
>ENDWITH
>
>DEFINE CLASS aaa as Custom
>HIDDEN hprop
>PROTECTED pprop
>hprop = .T.
>pprop = .T.
>prop = .T.
>ENDDEFINE
>
>The internal VARTYPE code, check for the defined property,
>it found true, then continue the process end search into the
>Object property list, but the property it is into the Class property list,
>and then the C++ code return a 1734 error:
>Property "name" is not found
>
>
>>
>>Try this:
>>
>>?VARTYPE(_screen.ActiveControl)
>>
>>Is bug or no?
>>
>>MartinJ
>
>I known this issue ( .ActiveForm have the same behaviour )
>My opinion ?.
>This contains two bugs:
>1. when ActiveControl have not a object value,
>VFP set it like hidden
>
>?PEMSTATUS(_screen, ' ActiveControl', 2)
>?PEMSTATUS(_screen, ' ActiveControl', 5)
>?VARTYPE(_screen.ActiveControl)
>
>the correct implementation it is to set
>_screen.ActiveControl = NULL with data type "O"
>
>2. Then the previous C++ code for vartype() appear also.
>
>Fabio
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Reply
Map
View

Click here to load this message in the networking platform