Information générale
Titre:
A very weird problem...
Here is some method code of a class in VCX,
let's assume its name is mm_caller, mm_checker
is another method whose code is empty meanwhile.
with this
if .mm_checker()
? "OK"
else
? "Fail"
endif
endwith
And here is defined & overrided code of method
mm_checker in child class:
with this
local bb
bb = CreateObject("cc")
with bb
local aa
do form ff to aa
if empty(aa)
return .F.
endif
.dd = "Hi"
endwith
endwith
Now the weird behavior comes, when form ff indeed return
an empty aa, mm_checker will still *ALWAYS* return .T. to
mm_caller.
But it will return the correct .F. if you write code this
order:
with this
local aa
do form ff to aa
if empty(aa)
return .F.
endif
local bb
bb = CreateObject("cc")
with bb
.dd = "Hi"
endwith
endwith
Is this a problem or CreateObject() or a bug of VFP6?
(It's OK in VFP5) It took me nearly 3 hours to debug
this out...
Chris Lee
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement