Re: getFocus on NSTextField
Re: getFocus on NSTextField
- Subject: Re: getFocus on NSTextField
- From: "Kevin Barnd" <email@hidden>
- Date: Thu, 06 Dec 2001 11:02:52 -0600
I think I'm starting to see how this works. I am coding in java (not by
choice), but I am new to both cocoa and java so some of these well known
concepts are still foreign to me. I am not familiar with subclassing. I read
up on it and thought that I got the idea but now i get an error in my
program. Here is what I did:
- created a subclass of NSTextField called SCTextField
- in the subclass i overid the becomeFirstResponder method
- i assigned the text fields in my .nib to the custom class SCTextField
then i get this error:
NSArchiverArchiveInconsistency (*** file inconsistency: read '@', expecting
'C')
2001-12-06 10:51:56.193 ChunkyCocoaEOF[1181] AppKitJava: exception = ***
file inconsistency: read '@', expecting 'C'
Do you know what I am doing wrong. Am I even going down the right path?
Thank you for your help and patience.
Kevin
From: Enigmarelle Development <email@hidden>
To: "Kevin Barnd" <email@hidden>
CC: email@hidden
Subject: Re: getFocus on NSTextField
Date: Wed, 5 Dec 2001 18:19:14 -0500
Sorry, I should have been more clear/thorough in my original message
(shouldn't send email while talking on the phone, watching TV, eating a
sandwich and trying to prevent crumbs from getting into the keyboard.)
It depends on what you need to do. If you want to do something when the
user starts typing into the field, using - (BOOL)control:(NSControl
*)control textShouldBeginEditing:(NSText *)fieldEditor in the field's
delegate or NSControlTextDidBeginEditingNotification might be more
appropriate than acting when the field becomes first responder (gets the
focus).
If you do need to find out when the field first gets focus (ie when the
user clicks or tabs into it) you could subclass it and override
-(BOOL)becomeFirstResponder, do whatever you need to do, and return YES.
See the NSResponder & NSControl documentation.
_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp