Hi Ken,

Many thanks for your reply.

> In most text-based apps, you insert a newline by hitting return and  
> a line break by hitting shift-return.

Most text-based apps on the Mac?  Because the default Cocoa text  
bindings use Control-Return or Control-Enter for insertLineBreak:.

A-hem. How embarrassing. All this time and I didn't know that; and nor did any 
of my power users point it out to me. "Text-based apps" was perhaps a bad 
choice of words, though. I should rather have said "word processors" as opposed 
to text editors. Although my own app is more of a text editor, it is used by 
writers who are generally coming from Word or Pages, both of which use 
shift-return for a line break (although Pages also has the control-return 
binding). Thus I would like to provide shift-return as an alternative, as this 
is a reasonably frequent feature request.


> Actually, as noted in a thread a few weeks ago, NSApplication only  
> routes keyboard events through the menus if certain modifier keys are  
> down.  Here's my contribution to that thread 
> <http://www.cocoabuilder.com/archive/message/cocoa/2008/3/28/202525 
>.  You can read through the rest of the thread for more info.


Thanks for that. That's interesting, I didn't know that.

> My question is, is there anything wrong with doing it this way? Or  
> is there a better way of getting the expected line break keyboard  
> shortcut that I am missing, given that regular routes don't work?

> Here's a very helpful post about customized key handling in text  
> views: <http://www.cocoabuilder.com/archive/message/cocoa/2008/6/6/209502 
>

Thanks. Yes, I know I can access such methods via the delegate method, but my 
text view is already heavily subclassed to add a lot of new features anyway. 
Whilst I could achieve the same in a delegate method, wherever it is, I was 
really wondering if there was anything particularly *wrong* with intercepting 
-insertNewline: (either by subclassing or in the delegate), checking for the 
shift key, and calling -insertLineBreak: if it is held down.

Many thanks again and all the best,
Keith


      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to