validateUserInterfaceItem not called


John Brownie
 

I implemented a new feature that brings up an NSTextField for entering data. Once it's done, I call removeFromSuperview() and it goes away as expected. But then validateUserInterfaceItem is no longer called for the view controller (a tab view item in another ViewController, all in a storyboard). I've tried calling becomeFirstResponder() on the view that was behind the NSTextField, but that doesn't help.

What am I missing? Does something else need to be called to get the view controller to validate its menus?

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Jeremy Hughes
 

I think you should be calling (NSWindow) makeFirstResponder.

Jeremy


John Brownie
 

Thanks, that was it.

John

Jeremy Hughes via Groups.Io wrote on 18/4/19 12:55:

I think you should be calling (NSWindow) makeFirstResponder.

Jeremy


--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Alex Zavatone
 

Sorry if this is too late, but isn’t there a resignFirstResponder that you could call on the text field?

Cheers,
Alex Zavatone

On Apr 18, 2019, at 11:55 AM, Jeremy Hughes via Groups.Io <moon.rabbit@...> wrote:

I think you should be calling (NSWindow) makeFirstResponder.

Jeremy




John Brownie
 

Alex Zavatone via Groups.Io wrote on 21/4/19 12:16:
Sorry if this is too late, but isn’t there a resignFirstResponder that you could call on the text field?
That doesn't work, either. I was trying to force it bottom-up (I thought that the next responder would automatically be made first), but it seems to want to be driven from the top, at the window level.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Alex Zavatone
 

My guess is that it remembers what the first responder was before, so resigning a first responder would return the responder to the previous one, like popping a value from the the stack. I guess it’s time for me to read up on the responder chain to see how it really tracks this.

On Apr 21, 2019, at 7:21 PM, John Brownie <john_brownie@...> wrote:

Alex Zavatone via Groups.Io wrote on 21/4/19 12:16:
Sorry if this is too late, but isn’t there a resignFirstResponder that you could call on the text field?
That doesn't work, either. I was trying to force it bottom-up (I thought that the next responder would automatically be made first), but it seems to want to be driven from the top, at the window level.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland