Dear Vixens and Reynards:
I just got bit by a gotcha with .AddObject().
I am writing (slowly) a better grid class (bettergrid). To
instantiate a bettergrid object, the containing form does an
.AddObject(). bettergrid::init() calls a method to initialise
with. This method is a stub in bettergrid:: that is meant to be
overridden. The stub returns .f.; an override should return .t.. If
.f. is returned, the instantiation of the bettergrid:: object will fail.
If instantiation was with
testgrid=createobject("bettergrid)
then checking for instantiation failing would be done by seeing if
testgrid is .f., that is:
type("testgrid")="L" and !testgrid
*** THE GOTCHA ***** This turns out to not be the case with
.AddObject(). Instead, the property does not exist at
all. Instantiation is by
this.addobject("testgrid","testgrid")
and the test is
type("this.testgrid")="U"
And here I thought that the test was so obvious that I almost
skipped checking it.
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.