huazilin wrote:
> I happened a difficult question.I have created a xpcom with the vc.The
> xpcom must fire an event to notify some status has been changed .Then
> the webpage can make some decision..But how to fire an event ,just like
> activex have a fireevent mechanism.
> Can some one help me ?
> Thank you very much!

I've done what you ask before by using the Observer pattern. Basically,
define an interface that your *client* must implement and make a method
in your component that accepts a pointer to that interface.

To illustrate (in psuedocode):
interface EventHandler { // your client implements the HandleEvent
method.
void HandlEvent();
}

then, in your component:
void subscribe(EventHandler* eh) { this->handlerList->add(eh); } //
store for use when the event is fired.
...
for each handler in handlerList {
handler->HandleEvent();
}

in the client:
component->subscribe(this);  // assuming "this" actually implements the
event handler interface....

I hope this helps.

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to