Sunday, May 22, 2011

Event notifications

I have been active on my ScreensOS project. I did another refactoring of the components and made it simpler to understand and easier to send notifications.

To register for an event:

CoreEventRegister(pObject, CoreNodeComponent, CORE_NODE_EVENT_MOVE, MyMoveCallback);

To send an event:

CoreEventNotify(pObject, CoreNodeComponent, CORE_NODE_EVENT_MOVE);

The advantage of this design is that each message is unique per component. No need to have selectors or string hashes. Each component just defines an enum of messages either public or private.

You can also send asynchronous messages using CoreEventNotifyAsync which doubles as a timer delay if the delayInMilliseconds parameter is non zero.

1 comment:

Alphasmart User said...

Hi.

I know I haven't commented here in a long time, but just to let you know, I am still following this, and am still here.