Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Init() method and hooks
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Init() method and hooks
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01120686
Message ID:
01120686
Views:
55
Hi!
I've a form class named 'pvform'.

The init method looks like this
if !this.preInitHook()
    return .F.
endif

..my code..

this.postInitHook()
Ok, I think this a quite standard init(), but how would you handle the call to "postInitHook()" in a new class subclassed from pvform??

Let's say I have a class "pvformselection" based on "pvform".
This is the pvformselection init():
if !dodefault()
    return .F.
endif

..my code..

this.postInitHook()
Do you see?
The postInitHook would be called twice.

What if I write:
if !dodefault()
    return .F.
endif

..my code..

if this.class == "Pvformselection"
   this.postInitHook()
endif
Consequently in the pvform class I'd have:
if this.class == "Pvform"
   this.postInitHook()
endif
Actually I don't like it too much. :-)

Maybe in this case using an hook is not a good solution, and it's better to write directly in the Init() method.
What do you think?
Next
Reply
Map
View

Click here to load this message in the networking platform