I have a simple form (NSWindow) with 3 text fields. NSWindow initialFirstResponder points to the first field ( NSTextField ). All three text fields are connected to each other using nextKeyView .
The problem is that when I launch the application from Xcode, it will focus on the text field that was the last active (in focus) when the application was closed.
So, for example, if I call the text fields A, B and C and initialFirstResponder set to A. Now, if I run the application, focus on B and close the application, the next time I run it, the focus will be on B.
Why is this and how can I fix it?
(Sorry if this is a trivial question, these are my first steps in cocoa ...)
EDIT:
This is on OS X Lion 10.7.1, Xcode 4.1.
EDIT 2:
I found a way to "fix" this ... In the main window (or in any other window) of the XIB / NIB file, click "Attributes Inspector" and then uncheck the "Restore" box. Now the application will not save the last position, and therefore the observation of initialFirstResponder will be respected and followed accordingly.
rytis
source share