Re: Setting the firstResponder in a view
Re: Setting the firstResponder in a view
- Subject: Re: Setting the firstResponder in a view
- From: Andre Masse <email@hidden>
- Date: Sun, 19 Jun 2011 08:39:43 -0400
Hi,
Well after a good night sleep, found the problem. I was using this call on my controller:
[[[self view] window] makeFirstResponder:myFirstResponderField]
I found that this kind of one liner is bad because it assumes too many things. I'll be more careful now. In this case, the problem was that the view's window was nil! I assumed that a view always had a window. I was wrong. Need to find why though.
Sorry for the noise,
Andre Masse
On 18/06/2011, at 16:51 , Andre Masse wrote:
> Hi List,
>
> I've been banging my head on this for awhile... I'm using a non document, non core data application. At this point this is a fairly common (I think) master/detail single window design. The window has a NSTabView with the master on one tab and detail on another, and a SourceView (like Mail) on the left side. This application is a front end to a PostgreSQL database.
>
> The common use case is:
> 1- user select a database table on the source view which sends a query to the backend
> 2- result is shown on the tableView
> 3- user select a row and click a button or double-click to see the detail view.
>
> Now, although I've set "nextKeyView" for all textFields, I just cant set focus on the NSTextField that I want to be first responder... It's always the topmost field that get the focus first. I tried to put [window makeFirstResponder:myFirstResponderField] everywhere I could think of without success. Since when the window appear on screen none of the views are present, I cant set the initialFirstResponder on the detail view, which is probably why my fancy key view loop is ignored.
>
> The only thing that works is using a button on the detail view which calls makeFirstResponder:myFirstResponderField on the window. Obviously, this is not an ideal solution...
>
> I'm probably missing something obvious and feel free to call me an idiot for overlooking this :-)
>
> Thanks and Cheers,
>
> Andre Masse
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden