Re: Removing focus from a textbox
Re: Removing focus from a textbox
- Subject: Re: Removing focus from a textbox
- From: Craig Hunter <email@hidden>
- Date: Thu, 11 Nov 2004 10:20:07 -0500
> * Subject: Re: Removing focus from a textbox
> * From: Severin Kurpiers <email@hidden>
> * Date: Wed, 10 Nov 2004 08:57:46 +0100
>
> Regular key shortcuts like Command + Q should work even if a control has the
> focus. But I assume you want to handle key events that are not the regular
> shortcuts, right? Probably you can try to set your window to be the first
> responder using something like:
>
> [window makeFirstResponder:window];
>
> It's just an idea, it needs of course some fine-tuning but it should take away
> the focus from your text box (NSTextField? NSTextView?)
>
>>
>> Hi Everyone,
>> I have a small app that has a bunch of key shortcuts
>> in it. The problem i am having is that the user has an
>> activated text box so that the key shortcuts wont
>> accept the input. I have a button that when pressed i
>> want to take the cursor focus away from that textbox.
>> I am already disabling the select and edit features of
>> the text box when the user presses the button. Is
>> there a way to draw focus away from that box upon and
>> action so that the app will accept key shortcuts? Thanks!!!
I am looking for a similar solution. In the case of my app, the window
containing the text field is already the first responder. It contains two
text fields and an OpenGL view. Normally, the user mouses around in the
OpenGL view and uses various hot keys to select objects. If they have just
entered text into one of the text fields and hit return, the field retains
focus and intercepts any of the hot keys that the user may be intending to
go to the OpenGL view. Using the tab key is slightly better, but because
there are two text fields, the user may need to hit tab twice to get focus
away from both text fields.
What I think we need is some method to make the text fields give up focus on
"return".
As far as I can tell "makeFirstResponder" only applies globally to NSWindow,
so it won't help manipulate objects within the window.
Craig
--
Dr. Craig A. Hunter
NASA Langley Research Center
AAAC / Configuration Aerodynamics Branch
(757) 864-3020
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden