Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Giving focus to a NSTextField in a custom view, which resides in a NSStatusItem...

Giving focus to a NSTextField in a custom view, which resides in a NSStatusItem...
Thread Tools
oVeRmInD911
Senior User
Join Date: Apr 2001
Location: Bolingbrook, IL, USA
Status: Offline
Reply With Quote
Sep 12, 2003, 02:23 PM
 
What I want to do is put a NSTextField as a menu extra. So in my nib I put a custom view down, placed a NSTextField in it, and hooked it all up to my controller object. In the controller's awakeFromNib method, it does the following:
Code:
- (void)awakeFromNib { NSStatusBar *bar = [NSStatusBar systemStatusBar]; theItem = [bar statusItemWithLength:NSVariableStatusItemLength]; [theItem retain]; [theItem setView:theView]; [theItem setHighlightMode:YES]; [searchField setEnabled:YES]; }
By the way, I declared theItem to be a NSStatusItem in the header. When I run it, it places the view with the text field in the menu bar just like I want it to, but the NSTextField can't get focused, so it's not really useful. Is there anything I can do to make that work? Maybe make a subclass of NSTextField or NSView and use that?
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:34 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,