Skip to main content
Inspiring
October 24, 2008
Question

UI Design - Best Practice when Two UIs Trigger Same Event

  • October 24, 2008
  • 1 reply
  • 754 views
I have an application that allows users to take actions using several methods - right-click context menu selection, menu bar selected, key strokes, etc. I was wondering if anyone had any suggestions as to teh best practices for handling this in Cairngorm...

Is it best to dispatch the same Cairngorm event in several places? I know this is one of the major reasons to use MVC, but, I hate to create duplicate code - maintenance is pain.

Would is be considered good practice to have the container that serves as a parent for the context menu, menu bar, etc. to listen for events from these components, and then dispatch the Cairngorm Event?

Thanks.
This topic has been closed for replies.

1 reply

Participant
October 28, 2008
Would it be considered good practice to have the container that serves as a parent for the context menu, menu bar, etc. to listen for events from these components, and then dispatch the Cairngorm Event?

Yes, this is described by Steven Webster in his series of articles on Cairngorm.

Dispatching the same Cairngorm event from different locations is a perfectly regular practice. This is even an advantage. The same code (the command, the delegate) can be triggered from different places.