‎2007 Oct 26 7:20 AM
when a static event is triggered then can an instance method can handle it and register at runtime so that it gets executed when that particular event triggers.
‎2007 Oct 26 9:48 AM
Dear Sandeep,
Static events can be triggered by any method of the class but static methods may only trigger static events.
The SET HANDLER statement links a list of handler methods to corresponding event triggers - either instance events or static events. The syntax and effect of the SET HANDLER statement differs according to the event type.
With instance events, you must use the FOR addition to specify the triggering instance for which you want to register the trigger. You can either specify a single triggering instance using a reference variable <ref>, or specify the handler for all instances using the statement SET HANDLER FOR ALL INSTANCES.
FOR ALL INSTANCES also applies to triggering instances that do not yet exist when the registration is made.
You cannot use the FOR addition with static events. Instead, the registrtation applies automatically to the entire class or all classes that implement an interface with a static event. The SET HANDLER statement also has an addition ACTIVATION, which allows you to register and deregister handlers automatically.
Regards
Kesava
‎2007 Oct 26 9:48 AM
Dear Sandeep,
Static events can be triggered by any method of the class but static methods may only trigger static events.
The SET HANDLER statement links a list of handler methods to corresponding event triggers - either instance events or static events. The syntax and effect of the SET HANDLER statement differs according to the event type.
With instance events, you must use the FOR addition to specify the triggering instance for which you want to register the trigger. You can either specify a single triggering instance using a reference variable <ref>, or specify the handler for all instances using the statement SET HANDLER FOR ALL INSTANCES.
FOR ALL INSTANCES also applies to triggering instances that do not yet exist when the registration is made.
You cannot use the FOR addition with static events. Instead, the registrtation applies automatically to the entire class or all classes that implement an interface with a static event. The SET HANDLER statement also has an addition ACTIVATION, which allows you to register and deregister handlers automatically.
Regards
Kesava
‎2007 Oct 26 11:02 AM
Hi Sandeep,
Yes. Instance method can handle the static event and register for that.
As a matter of fact there is no restriction as per handling of the event.
See the handling is done at run time so we cant restrict the same at design time.
Got the point.
What we can restrict at design time is triggering the event, I mean RAISE EVENT. Instance methods can trigger any events.
Static methods can trigger only static events.
Gr8 enthusisam. Keep going . Get back if u have further doubts.
Reward points if useful,
Aleem.