문제

I am developing an interface for an OpenGL Simulation on the Mac using Interface Builder. All OpenGL stuff is being written in C++ (which I know fairly well). Unfortunately I have no idea about Objective-C.

Basically, I have a few NSTextField displaying info on an object selected on the Screen. Using these textfields the user is the able to manipulate the object on screen and then there is a Save Button and a Restore Button (which either save the new values or restore the original ones)

I have this all working. My problem is when I enter data into an NSTextField the "focus" of the windows seems to remain on the NSTextField (blue border remains around it).

I use the keyboard to interact with items within the NSOpenGLView, I need to pass the focus back to the NSOpenGLView when I hit either the Save or Restore buttons.

Sorry if this is a very straightforward question

Thanks

David

도움이 되었습니까?

해결책

Have you tried using NSWindow makeFirstResponder method to make your NSOpenGLView the first responder?

다른 팁

Just managed to get it working.

I had to add the line:

[[NSApp keyWindow] makeFirstResponder: MyOpenGLView];

to the end of the function being called when I click on either of my buttons.

(Thanks Julio for pointing me in the right direction)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top