nsstatusitem

NSStatusItem with NSPopover and NSTextField

亡梦爱人 提交于 2019-12-04 15:24:42
I have a NSStatusItem that displays a NSPopover which contains a NSTextField but the text field isn't editable although it has been so be so in Xcode. Now this is a known bug and there is apparently a solution someone posted here . I really need to work around this bug. I'll just quote the answer here for convenience: The main problem is the way keyboard events works. Although the NSTextField (and all his superviews) receives keyboard events, he doesn't make any action. That happens because the view where the popover is atached, is in a window which can't become a key window. You can't access

Cocoa - Custom appearance of NSStatusItem in menu bar

旧城冷巷雨未停 提交于 2019-12-04 13:59:15
问题 It is easy to set the title and length of an NSStatusItem. Is is possible to change the appearance of the NSStatusItem entirely, and replace it with a custom view? For example, if I want my NSStatusItem to be a whole row of icons surrounded by a border, rather than just a single icon, and each icon can be separately clicked. Is this possible? 回答1: Got it. I can use NSStatusItem's setView: method to completely customize the appearance of the NSStatusItem. An example of this is here. 来源: https:

How to develop status bar app in OS X Yosemite?

烈酒焚心 提交于 2019-12-04 11:17:22
问题 I've been trying to develop a status bar app for Yosemite, which is my first OS X app, but when I searched for the document, the NSStatusItem documentation says that almost all of the properties and methods there (e.g. .title , .highlightMode , and .image ) are deprecated in OS X 10.10. So I wonder how I can create a status bar app for Yosemite. I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. But I know they are usually slow to

NSStatusItem fullscreen issues

怎甘沉沦 提交于 2019-12-04 11:03:53
I'm making a statusbar app that displays an NSPopover when the NSStatusItem is clicked, like this: I have added the ability to resize the popover by dragging on the edges, by subclassing the popover's view like this: class CMView: NSView { let tolerance : CGFloat = 10 var state = false override func mouseDown(theEvent: NSEvent) { let point = self.convertPoint(theEvent.locationInWindow, fromView: nil) if (point.y <= tolerance) { state = true } } override func mouseDragged(theEvent: NSEvent) { if (state) { let point = self.convertPoint(theEvent.locationInWindow, fromView: nil) self.frame =

Cocoa - Custom appearance of NSStatusItem in menu bar

拟墨画扇 提交于 2019-12-03 08:46:28
It is easy to set the title and length of an NSStatusItem. Is is possible to change the appearance of the NSStatusItem entirely, and replace it with a custom view? For example, if I want my NSStatusItem to be a whole row of icons surrounded by a border, rather than just a single icon, and each icon can be separately clicked. Is this possible? Got it. I can use NSStatusItem's setView: method to completely customize the appearance of the NSStatusItem. An example of this is here . 来源: https://stackoverflow.com/questions/4952412/cocoa-custom-appearance-of-nsstatusitem-in-menu-bar

How to develop status bar app in OS X Yosemite?

ぃ、小莉子 提交于 2019-12-03 07:05:52
I've been trying to develop a status bar app for Yosemite, which is my first OS X app, but when I searched for the document, the NSStatusItem documentation says that almost all of the properties and methods there (e.g. .title , .highlightMode , and .image ) are deprecated in OS X 10.10. So I wonder how I can create a status bar app for Yosemite. I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. But I know they are usually slow to update the documentation, though I wonder then how and where Dash got those seemingly updated

Custom NSView in NSMenuItem not receiving mouse events

落花浮王杯 提交于 2019-12-03 03:22:18
I have an NSMenu popping out of an NSStatusItem using popUpStatusItemMenu. These NSMenuItems show a bunch of different links, and each one is connected with setAction: to the openLink: method of a target. This arrangement has been working fine for a long time. The user chooses a link from the menu and the openLink: method then deals with it. Unfortunately, I recently decided to experiment with using NSMenuItem's setView: method to provide a nicer/slicker interface. Basically, I just stopped setting the title, created the NSMenuItem, and then used setView: to display a custom view. This works

Creating status item - icon shows up, menu doesn't

元气小坏坏 提交于 2019-12-02 18:07:50
问题 In a document-based project I am trying to create a status menu. I have a singleton class that builds the status bar, and I am initiating it from an application delegate, as you can see. When I run this, I get no errors, but only an image of the status bar, but no menu drops down. I created the menu in IB. What am I messing up? Delegate #import "KBAppDelegate.h" #import "KBStatusMenu.h" @implementation KBAppDelegate @synthesize window = _window; - (void)applicationDidFinishLaunching:

Creating status item - icon shows up, menu doesn't

亡梦爱人 提交于 2019-12-02 07:36:00
In a document-based project I am trying to create a status menu. I have a singleton class that builds the status bar, and I am initiating it from an application delegate, as you can see. When I run this, I get no errors, but only an image of the status bar, but no menu drops down. I created the menu in IB. What am I messing up? Delegate #import "KBAppDelegate.h" #import "KBStatusMenu.h" @implementation KBAppDelegate @synthesize window = _window; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { KBStatusMenu *aStatusItem = [[KBStatusMenu alloc] init]; aStatusItem = [

Main Thread Runloop gets blocked on opening nsmenu

房东的猫 提交于 2019-12-01 23:46:59
I have an application for which the UI element includes an NSStatusItem and a menu. Inside my application , I am using NSTask asynchronously to perform some operation and I am using the output obtained using the NSFileHandleReadCompletionNotification to update the menu. But now whenever I click and open the menu , the main runloop goes into NSEventTrackingRunLoopMode and the notification posting fails. So basically with my menu open , no operation takes place on the main thread. Now I found a similar problem on this post but the accepted solution there does not seem to help. I understand that