• 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
Selecting NSTextFieldCell as First Responder?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Selecting NSTextFieldCell as First Responder?


  • Subject: Selecting NSTextFieldCell as First Responder?
  • From: Rob Frohne <email@hidden>
  • Date: Sun, 1 Sep 2002 14:41:16 -0700

Hi All,

I'm very new to Cocoa programming, and can't seem to make the NSTextFieldCell in an NSArray of NSTextFields that I want to be the one selected when the application starts. I have tried setInitialFirstResponder and makeFirstResponder without success so far.

If I do this:

[[displayMatrix window] makeFirstResponder:[[displayMatrix cells] objectAtIndex:XDISPLAY]];

I get this error:

2002-09-01 14:31:34.825 SimpleRPN[6320] *** -[NSTextFieldCell becomeFirstResponder]: selector not recognized
2002-09-01 14:31:34.906 SimpleRPN[6320] Exception raised during posting of notification. Ignored. exception: *** -[NSTextFieldCell becomeFirstResponder]: selector not recognized

If I use setInitialFirstResponder instead of makeFirstResponder, I don't get the error, but the correct cell isn't active upon startup.

If I

[[displayMatrix window] makeFirstResponder: displayMatrix ];

I get no errors, but of course it doesn't select the matrix cell I want of course, since I didn't tell it about which cell I wanted selected.

Can anyone help me out?

Thanks,

Rob

P.S. Here is a larger segment of my code if it helps:

@implementation Controller(ApplicationNotifications) //Delegates

-(void)applicationDidFinishLaunching:(NSNotification*)notification
{
//This is the initialization routine.
//The next line is our attempt to set the focus on the XDISPLAY.
// [[[displayMatrix cells] objectAtIndex:XDISPLAY] setInitialFirstResponder:[[displayMatrix cells] objectAtIndex:XDISPLAY]];
// [[[displayMatrix cells] objectAtIndex:XDISPLAY] selectText:self];
// NSWindow *win = [displayMatrix window];
// [win setInitialFirstResponder:[[displayMatrix cells] objectAtIndex:XDISPLAY]];
[[displayMatrix window] makeFirstResponder:[[displayMatrix cells] objectAtIndex:XDISPLAY]];
//[[displayMatrix window] makeFirstResponder: displayMatrix ];

[self clearAll:self];
}

@end

--
Rob Frohne, Ph.D., P.E.
E.F. Cross School of Engineering
Walla Walla College
http://www.wwc.edu/~frohro/
_______________________________________________
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.

  • Prev by Date: Re: Accessing array from class [newbie]
  • Next by Date: Testing an NSImageView?
  • Previous by thread: Re: [newbie] Using progress indicators in different threads
  • Next by thread: Re: Selecting NSTextFieldCell as First Responder?
  • Index(es):
    • Date
    • Thread