Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTextField inside NSStatusBar: focus and editable problems

My Cocoa App is made by a NSStatusBar with a NSTextField inside and a Main Window.
Please, look the screenshots to get the idea:

enter image description here

I have two problems:

  1. When I open Menubar I am unable to got the focus to SearchField (like Spotlight) and I am unable to select content with something like [textField selectText:self]

  2. Worsts: if my MainWindow is on front it works without problems. If my MainWindow is not on front but is visible I am unable to edit TextField. It is selectable with mouse but not editable. Why this ?

enter image description here

I tried all the hacks found but I was unable to solve the issue.

like image 351
pierocampanelli Avatar asked Oct 18 '11 07:10

pierocampanelli


1 Answers

I have also had this problem so I ended up completely recreating NSMenu using a NSWindow. I named it JGMenuWindow and you can find the open source code on GitHub here.

Here's an example of what it can do:

enter image description here

like image 162
Joshua Avatar answered Sep 27 '22 15:09

Joshua