Re: NSTextMovement
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