Ask a Question related to Mac Programming, Design and Development.
-
Alain Birtz #1
becomeFirstResponder and key equiv. for OK button
The action for the OK button check if the editable NSTextField
hold valid date. For error the faulty NSTextField is set to
first responder with becomeFirstResponder.
This work fine when the OK button is clicked but when the Return key
(key equiv. for the OK button) is hit becomeFirstResponder does nothing:
the text cursor stay in the (wrong) NSTextField.
The OK action method is called but becomeFirstResponder does nothing.
(NSTextField and button in NSPanel)
What can I do ?
Thank you.
Alain Birtz Guest
-
does ActionScript have java equiv of.....
does ActionScript have java equiv of: Class cls = Class.forName("SomeClass"); i don't want an instance of the object, just an instance of the... -
javascript=escape() perl=(looking for equiv)
anybody know what the per equilivent to the javascript escape() function. thanks in advance john -
Perl equiv to PHP file() ?
Does Perl have an equivalent to the PHP function file()? file() reads a file into an array. More importantly for me, you can pass a URL to file(),... -
Perl equiv to PHP file()
(Slightly OT.) Does anybody here who works in both PHP and Perl happen to know whether there is a Perl equivalent to PHP's file(url)? I need to... -
Network problem mac equiv windoze command
I've been having problems with my local network and was supplied with the following windoze solution. I have all OS 9.1 machines. Is there a way... -
Chris Hanson #2
Re: becomeFirstResponder and key equiv. for OK button
In article <abz-0908031757460001@192.168.1.3>, Alain Birtz
<abz@videotron.ca> wrote:
You should try to do this with a formatter, if possible. If you just> The action for the OK button check if the editable NSTextField
> hold valid date.
need to ensure that the date the user entered is properly formatted, an
NSDateFormatter will do this for you automatically and even allow
natural-language entry (like "today" and "Friday").
If you need to do something more complicated like validate a date
range, then what you're doing now is probably an acceptable solution.
(It'd be better though not to let the user enter out-of-range dates to
begin with, but that is more complex to code.)
You should be using -[NSWindow makeFirstResponder:] instead, since the> For error the faulty NSTextField is set to
> first responder with becomeFirstResponder.
first responder is really a property of the window. The documentation
for -[NSResponder becomeFirstResponder] says this quite explicitly.
("Never invoke this method directly.")
-[NSWindow makeFirstResponder:] ensures that the current first
responder is resigned, if possible, and that the responder is changed,
if possible, and will return NO if for some reason it's not possible.
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: [email]cmh@bDistributed.com[/email]
Custom Application Development | Phone: +1-847-372-3955
[url]http://bdistributed.com/[/url] | Fax: +1-847-589-3738
[url]http://bdistributed.com/Articles/[/url] | Personal Email: [email]cmh@mac.com[/email]
Chris Hanson Guest



Reply With Quote

