Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Global notify list
Wed, Oct 26 2016 5:57 AMPermanent Link

Matthew Jones

Has anyone done any sort of "global notification list"? Basically, some sort of event distribution system with listeners.

I'm not even sure how to store an event in a list. I could do it in an array I guess.

Basically, I want to be able to say:

 g_xEventManager.AddListener(EVENT_ID, MyEventHandler, self);

and something else to say:

 g_xEventManager.Notify(EVENT_ID, triggerObject);

So something in the UI could trigger the event, and anything listening would get called to its event handler, passing in the trigger object (if anything, otherwise nil). This would allow the notifier to also ignore its own event if it was listening, because the trigger is itself, or something it uses.

I half wonder if I've asked this before, or if there is something already built in... Anyone done this before?

--

Matthew Jones
Wed, Oct 26 2016 5:58 AMPermanent Link

Matthew Jones

Matthew Jones wrote:

>   g_xEventManager.AddListener(EVENT_ID, MyEventHandler, self);

Also need to be able to remove itself. Not sure if it should therefore use "self" again, or be returned an integer to pass back in to remove, but that risks bugs. Hmm.

--

Matthew Jones
Tue, Nov 1 2016 3:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Has anyone done any sort of "global notification list"? Basically, some sort of event distribution system with listeners. >>

You could use the built-in TComponent notification mechanisms to do this, although they might not be entirely what you want.  Check out the WebCore unit for more information.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Nov 2 2016 5:57 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> << Has anyone done any sort of "global notification list"? Basically, some sort of event distribution system with listeners. >>
>
> You could use the built-in TComponent notification mechanisms to do this, although they might not be entirely what you want.  Check out the WebCore unit for more information.

Looks perfect, and even has cmUser ready and waiting. Thank you.

--

Matthew Jones
Image