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
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01120686
Message ID:
01120717
Views:
19
You could make 3 methods and then modify them as needed
IF !THIS.PreInitHook()
   RETURN .F.
ENDIF

THIS.CustomInit()

THIS.PostInitHook()
You will no longer modify the Init() method itself just your custom methods.

>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?
Wine is sunlight, held together by water - Galileo Galilei
Un jour sans vin est comme un jour sans soleil - Louis Pasteur
Water separates the people of the world; wine unites them - anonymous
Wine is the most civilized thing in the world - Ernest Hemingway
Wine makes daily living easier, less hurried, with fewer tensions and more tolerance - Benjamin Franklin
Previous
Reply
Map
View

Click here to load this message in the networking platform