[Dev] Menu items support named dispatch
Donn Denman
donn at osafoundation.org
Tue Aug 2 14:30:48 PDT 2005
I'll change the attribute name from eventsForNamedDispatch to
eventsRegisteredByName to avoid the confusion with an event's
dispatch mechanism.
- Donn
On Aug 2, 2005, at 2:23 PM, John Anderson wrote:
> eventsForNamedDispatch are a list of events for a block. When this
> block is rendered, these events are added to the list of events
> that you can dispatch by name. When the block is unrendered, the
> events are removed the from the list of events that can be
> dispatched by name. So it controls which events you can dispatch by
> name. All events, whether refered to directly via a reference or
> looked up by name are dispatched the same way. Dispatching by name
> is just another way to find an event which is dispatched like all
> other event.
>
> All events go to onXXXEvent methods.
>
> Broadcast describes how the event is dispatched, e.g. the event is
> sent to more than one block
>
> Dispatch-by-name events typically don't go to blocks who have
> eventsForNamedDispatch
>
> John
>
> Alec Flett wrote:
>> (This is probably more a question for John)
>> I'm not sure I understand the use of eventsForNamedDispatch? this
>> is something put on the target block that is to receive the event
>> from the menu item? What dispatch type gets sent to blocks with
>> eventsForNamedDispatch?
>>
>> If that's the case, then it seems like we have (somewhat, not
>> completely) redundant named events registration - at least it
>> seems like:
>> a) "Broadcast" events go to blocks whose classes have onXXXEvent
>> methods
>> b) "Dispatch-by-name" events go to blocks who have
>> eventsForNamedDispatch set to the right event.
>>
>> Aren't these effectively the same idea except for the mechanism
>> used to actually find the target events (Broadcast walks the tree
>> while I think the other method has some sort of registration
>> mechanism?)
>>
>> Alec
>>
>> Donn Denman wrote:
>>> Summary
>>> ------------
>>> If you ever create menu items for Chandler, you probably should
>>> have an attribute defined for "eventsForNamedDispatch" on your
>>> MenuItem, or it won't be accessible from CPIA Script.
>>>
>>> Details
>>> --------
>>> In our dynamic user interface, where blocks come and go, it's
>>> handy to have a mechanism that sends an event to whichever block
>>> is available to handle that event. For this reason CPIA has had
>>> the ability to dispatch to events using the event's name. This
>>> is implemented as an attribute "eventsForNamedDispatch" on
>>> Block. Essentially, this allows the block to publish events
>>> that it, or its children blocks, can handle. This feature has
>>> not been widely used, until now.
>>>
>>> CPIA Script is now leveraging off of CPIA's named event
>>> dispatch, picking up any events that have been published. So
>>> now there's a second reason to use "eventsForNamedDispatch" on
>>> blocks you create - they will be visible to CPIA Script. I
>>> have already updated all the blocks that define events, mostly
>>> Menu items and Toolbar items, to publish their events if
>>> appropriate. In the future, when you're creating menus, or
>>> blocks in general, consider if you want your event to be
>>> accessible to others, and from CPIA Script. If you don't want
>>> your menu to be scriptable, don't add the
>>> "eventsForNamedDispatch" attribute, and that will keep your
>>> event from being directly callable.
>>>
>>> This information will go into the CPIA Author's Guide once we get
>>> a chance to write it.
>>>
>>> - Donn Denman
>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>>
>>> Open Source Applications Foundation "Dev" mailing list
>>> http://lists.osafoundation.org/mailman/listinfo/dev
>>
>>
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>> Open Source Applications Foundation "Dev" mailing list
>> http://lists.osafoundation.org/mailman/listinfo/dev
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/dev/attachments/20050802/aa9cc4e0/attachment.htm
More information about the Dev
mailing list