Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Orphan object
Message
From
08/08/2017 09:00:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Orphan object
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01653145
Message ID:
01653145
Views:
92
Just when I thought I saw it all...

Using GoFish I was looking for a duplicate of a method, and all the places where it may be called - just housekeeping and cleaning up. In a certain class, it found it in four places:
- honorable mention in Resered3, prefixed with a *, i.e. this is a custom method to this class
- the method itself (in the procedure blabla, which isn't visible in the editor but it's there in the methos memo)
- rightclick in a grid (expected caller)
- click of some button on the page, just below the grid.

Except the button isn't there. Yet GoFish finds it every time. The editor doesn't see it, the aselobj() gives a reference to any of its parents but they don't have it as a member, PEM window doesn't see it, PemEd doesn't see it.

So I went ito GoFish's datasession, opened its cursor for the results grid, and it says this phantom control's recno() is 502. OK... open the classlib as a table, browse - there it is.

Then it dawned on me. How this class came to be. I was reworking a whole series of containers to base them on a different class, to have a different pageframe etc. Depending on how complicated it was, I'd sometimes do a saveAsClass(), repointer the new class to a different parent, rename pages in the properties memo of the pageframe (must do that or all kinds of errors pop up). Sometimes I'd just create a new class and copy-paste objects from the old one, page by page, clone non-default properties of those which existed in both etc. There was even a third method, which I don't quite remember, this is something I do when time permits, which isn't every day.

So what happened? Somewhere along the way I copied something from the old to new, redefined something, and the new properties of the page didn't mention this button. It should have a line containing
TheButton.name="TheButton"
(which is one of those bootstrap pulling definitions, what came first, egg or egg?). That's what Fox uses as a list of members (just having a proper parent reference in the child record isn't enough), and this one was missing on the list. Since I wanted to get rid of the button, I just deleted record 502 in the classlib, recompiled the classlib, done.

If anyone wants to create an orphan object in a vcx/scx, this is one way to do it.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Reply
Map
View

Click here to load this message in the networking platform