Hi Todd, | I would like a more experienced opinion. Am I doing this the best way? Perhaps instead of | a multi-dimentional array like object, I should introduce a ShortcutManager class which | will have logic for context and a way to invoke a Shortcut function for event data. What | do you guys think?
Again, you've pre-empted what I think is the bad-smell here; the controller at first seems like a really elegant place to do a "point-cut" of this shortcut functionality, but the nail I think you've hit on the head, is that often shortcuts are context-sensitive; ie the delete key may be a shortcut for several different commands, eg DeleteUserCommand, DeleteMessageCommand, DeleteAddressCommand, etc ... and *which* of these commands to fire on pressing delete, would very much depend on the implicit state of the application. Now ... if you have a state-machine in your application for managing state, then I can see an interesting implementation where given a keypress and the current state, you could determine the next state and broadcast the appropriate event. So you'd move the functionality into your FSM (Finite State Machine). But the solution you've proposed might just be the simplest thing that works for the solution you require. Certainly centralising behavior in the controller is a good thing. I think personally, I'd want a KeyListener class that listens for keyboard shortcuts and broadcasts events+data to the controller. Whether you tied keypress into context/state or not, this would be encapsulated in the KeyListener class, and your controller would be none-the-wiser (a good thing IMHO). I'm happy to be convinced otherwise however. And if you produce a neat keyboard shortcut (and even better, tie that into a state machine implementation) solution, and want to contribute it back to the Cairngorm source, then give me a shout :) I think this would be an interesting and potentially generic piece of reusable architecture. Thoughts ? Steven -- Todd Boland Charged Software Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/