lundi 2 mars 2015

When should you use AppKit's key-action methods?


...as opposed to mapping each key in the code yourself to an appropriate method within the keyDown() method implementation you are most likely overriding. I am specifically asking in the context of NON textfield-like controls/views.


Background


key-action methods allow you to link pre-defined (and customisable in an xml file) shortcut keys to pre-named methods within NSResponder. The plumbing of linking shortcuts up to the named events is taken care of for you within AppKit.


I can itemise the following pros and cons of using them: + the actions are generic and keys to use should be well known from other apps + the keys are ‘easily’ re-mappable/customisable in an external dictionary file + the keys have already been mapped for you (saves time) + it will search the action-method responder chain for an implementation (flexibility) - works best for textfields; metaphor starts to fall apart for other things


Am I missing any pros/cons?





Aucun commentaire:

Enregistrer un commentaire