![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
OK, Ok, sorry everyone. It seems that my brain is more eager to get things done than my common sense. It is not possible to rasie an event during class initialisation or termination. This is of course why it isnt doing anything :-) Then the issue becomes - what is an effective workaround for this? I need to create a notofication when the class has completed its initialisation. Same with the termination of the class. Any help appreciated. Cheers The Frog |
#4
| |||
| |||
|
|
On Thu, 1 Apr 2010 05:00:19 -0700 (PDT), The Frog mr.frog.to.you (AT) googlemail (DOT) com> wrote: It seems to me after: Set VariableName = new ClassName the class (better: object) is created and ready to use. You could write: Set VariableName = new ClassName Call Initialized() The other thing I have done is make the constructor and destructor extremely light-weight (essentially no-ops), and add an Init and Exit method to do the initialization and cleanup of the object. THOSE methods can raise events. The developer would need to know to call these methods, or you can call them (at least Init) at each normal method call if Init had not yet been called: public method DoSomething if _HasInitBeenCalled = false then call Init() end if (Init would set this boolean value) -Tom. Microsoft Access MVP |
| OK, Ok, sorry everyone. It seems that my brain is more eager to get things done than my common sense. It is not possible to rasie an event during class initialisation or termination. This is of course why it isnt doing anything :-) Then the issue becomes - what is an effective workaround for this? I need to create a notofication when the class has completed its initialisation. Same with the termination of the class. Any help appreciated. Cheers The Frog |
#5
| |||
| |||
|
|
"Tom van Stiphout" <tom7744.no.spam (AT) cox (DOT) net> wrote in message news:vlnar5pbm4odn7pg0prhdis4mo7l8h0pu7 (AT) 4ax (DOT) com... On Thu, 1 Apr 2010 05:00:19 -0700 (PDT), The Frog mr.frog.to.you (AT) googlemail (DOT) com> wrote: It seems to me after: Set VariableName = new ClassName the class (better: object) is created and ready to use. You could write: Set VariableName = new ClassName Call Initialized() The other thing I have done is make the constructor and destructor extremely light-weight (essentially no-ops), and add an Init and Exit method to do the initialization and cleanup of the object. THOSE methods can raise events. The developer would need to know to call these methods, or you can call them (at least Init) at each normal method call if Init had not yet been called: public method DoSomething if _HasInitBeenCalled = false then call Init() end if (Init would set this boolean value) -Tom. Microsoft Access MVP Sounds like a plan, although if I might make a suggestion, the _HasInitBeenCalled variable could be a static var in the Init routine, the 1st line of which would check it and exit the proc if True. That way the methods need only call the Init routine instead of doing the checking in more than one place. OK, Ok, sorry everyone. It seems that my brain is more eager to get things done than my common sense. It is not possible to rasie an event during class initialisation or termination. This is of course why it isnt doing anything :-) Then the issue becomes - what is an effective workaround for this? I need to create a notofication when the class has completed its initialisation. Same with the termination of the class. Any help appreciated. Cheers The Frog |
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |