I'm having a problem getting a NSSearchField to work properly in an NSStatusItem a la the Apple Help menu or the Apple Spotlight menu.

Here's what's happening.

I create my custom NSStatusItem / menu / custom view/ search field, and insert into into the status bar in -awakeFromNib. Setting the LSUIElement property in the Info.plist file then results in everything displaying and working correctly the very first time the NSStatusItem is clicked (after running the application from Xcode and it becomes "active"). The associated menu pops up with the custom view and search field, the search field has focus, shows the insertion pointer, and I can type a search term, press enter, and everything works great. But if I select the NSStatusItem a second time to perform a second search there is no insertion pointer, and I can't select the search field. When I try clicking around the custom view several times I get the following error:

HIViewSetFocus() failed with error -30599

Now, if I don't set the LSUIElement property in the Info.plist file, and just run the application as a normal application, then I can get around the above problem by selecting the application first (making it active) and then the search field in the menu associated with the NSStatusItem always gets focus, the insertion pointer appears, and everything works fine. But I want to build an application that doesn't have a doc icon, window, or main menu using the LSUIElement property setting.

From what I understand, it seems that the application needs to be "active" in order for the search field to get focus and for the text insertion pointer to appear, but I don't understand how to "force" this for an application that doesn't have a main window, doc icon, or menu bar by enabling LSUElement.

Can anyone help?

Best,
Dalmazio

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to