• 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: NSTextMovement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextMovement


  • Subject: Re: NSTextMovement
  • From: Tony Cate <email@hidden>
  • Date: Sun, 10 Jul 2005 15:22:16 -0500

On Jul 10, 2005, at 1:43 PM, Greg Titus wrote:


On Jul 10, 2005, at 10:37 AM, Tony Cate wrote:


What I want is NSBackReturnTextMovement - The Shift-Return key was pressed. Currently NSText ignores the shift key and sends NSReturnTextMovement. I want this for a tableview. When users press Enter the equivalent cell is selected in the next row. When Shift-Return is entered I want the equivalent cell selected in the previous row.

I'm not even sure what to try overriding. Any hints?


You'll need to look for NSReturnTextMovement, and if you get it, then do an:


    if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)

to see if the shift key was held or not.

That did the trick. Thank you Greg.

An oddity in getting there. This would NOT compile:

- (void)controlTextDidEndEditing:(NSNotification *)notification
{
    NSDictionary *userInfo = [notification userInfo];

int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue];
NSEvent* currentEvent = [NSApp currentEvent];


    if (textMovement == NSReturnTextMovement)
    {
        if([currentEvent modifierFlags] & NSShiftKeyMask)
            int x = 2;
    }
}

But this would:

- (void)controlTextDidEndEditing:(NSNotification *)notification
{
    NSDictionary *userInfo = [notification userInfo];

int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue];
NSEvent* currentEvent = [NSApp currentEvent];


    if (textMovement == NSReturnTextMovement)
    {
        if([currentEvent modifierFlags] & NSShiftKeyMask)
        {
            int x = 2;
        }

    }
}

I'm puzzled... (I assume someone will give me dope slap.)


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTextMovement (From: Tony Cate <email@hidden>)
 >Re: NSTextMovement (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Protocol compiler hint vs no hint....
  • Next by Date: Re: Protocol compiler hint vs no hint....
  • Previous by thread: Re: NSTextMovement
  • Next by thread: getting USB devices info
  • Index(es):
    • Date
    • Thread