• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Thanks for the TableView hint.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thanks for the TableView hint.


  • Subject: Re: Thanks for the TableView hint.
  • From: Jerry LeVan <email@hidden>
  • Date: Wed, 3 Mar 2004 10:17:08 -0500

I did not show all of the code, the fragment occurs in a routine:

// we want to handle the "enter" key in a special way so we have to make ourself the
// delegate of inputTextView
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
{
NSRange selRange,aRange;
if( @selector(insertNewline:) == commandSelector)
{
// shift/return or enter?
NSString *characters = [[NSApp currentEvent] characters];
unichar ch = [characters characterAtIndex:0];

if( !( (ch == NSEnterCharacter) ||
(ch == NSCarriageReturnCharacter) &&
([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
)
) return NO ;

// OK, we have the enter or shift return key pressed, first check to see if there is a selection
// and if so, execute the selection.

On Mar 3, 2004, at 9:49 AM, Allan Odgaard wrote:

On 3. Mar 2004, at 15:25, Jerry LeVan wrote:

NSString *characters = [[NSApp currentEvent] characters];
unichar ch = [characters characterAtIndex:0];

Some events may not generate characters! so check string length before accessing the character at index zero.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Fwd: Thanks for the TableView hint. (From: Jerry LeVan <email@hidden>)
 >Re: Thanks for the TableView hint. (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: Changing NSTableView cell editing behaviour
  • Next by Date: NSRulerView and NSRulerMarker
  • Previous by thread: Re: Thanks for the TableView hint.
  • Next by thread: uninitialize
  • Index(es):
    • Date
    • Thread