nspopover

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

Should an outlet to a view controller class be weak or stong? OSX app

你。 提交于 2019-12-04 14:52:30
Here's what i did. Make a clean OSX project. went to main.xib and dragged a popover controller. This created 2 visible objects on on interface builder. I went to the appDelegate.h file and did `-@Property ( assign ) IBOutlet NSViewController *popVC; Then i went to the applicationDidFinishLaunching: method and did popVC = [[NSViewController alloc] init]; Result: I get the following error message: Shouldnt objects on a nib be weak since it is already owned by the nib? Outlets to view controllers should be strong . The NIB doesn't own the objects, its just an archive. Outlets to views should

Getting access to NSPopover window to set level?

时光怂恿深爱的人放手 提交于 2019-12-04 04:29:25
When a popover shows, I'm curious whether it's possible to set the underlying settings on the popover's window, such as the window level. In my testing, popovers seem to be a window, but they doesn't respond to normal NSWindow selectors, such as setLevel: . Is it possible to set the window level on a NSPopover ? NSPopover is a subclass of NSObject , not NSWindow , so setting the window level is not officially supported. You could try getting the window like this: NSWindow* popoverWindow = yourPopover.contentViewController.view.window; I have no idea whether you can then successfully set the

NSPopover to start in a detached state

孤人 提交于 2019-12-03 16:54:54
Is there a way to force the NSPopover to start in the detached state? I only see isDetached which is a read-only property for the state of the popover and an NSPopoverDelegate method detachableWindow(forPopover:) which lets me override the window that gets created. I'd like to essentially click a button and have the NSPopover start in the state in this photo. The style of this window is exactly what a product requirement is and I can't seem to find any NSWindow style settings that would make a window do something like this (nor an NSPanel) This detached popover functionality seems special in

Animating Auto Layout changes concurrently with NSPopover contentSize change

China☆狼群 提交于 2019-12-03 08:55:12
I'm attempting to reproduce the iTunes 11 behavior of navigable views within a popover. I can't seem to find a way to get my animation to happen at the same time as the popover's contentSize change happens, though. The basic setup I have is a custom view subclass MyPopoverNavigationView with two subviews: the old and new views that I want the popover to navigate between. The popover's contentViewController has a MyPopoverNavigationView instance as its view . I do this: // Configure constraints how I want them to show the new popover view [NSAnimationContext runAnimationGroup:^

NSPopover below caret in NSTextView

柔情痞子 提交于 2019-12-03 08:50:40
I know that in order to show a popover I need an NSView, but I don't think that there is one associated with the caret (inside the NSTextView). Is there a way to show a NSPopover below the caret? I tried to alloc a NSView and position it using (NSRect)boundingRectForGlyphRange:(NSRange)glyphRange inTextContainer:(NSTextContainer *)container , but the popover will not appear (and there's a reason, that method returns NSRect: {{0, 0}, {0, 0}} ). I'm not sure if you are still looking for answer. I recently was working on a project which happens to need a very similar feature like you described.

Force NSPopover to not become first responder with NSTokenField

爱⌒轻易说出口 提交于 2019-12-03 08:19:32
I'm having a NSTokenField and I'm providing a custom autocompletion inside the popover. Unfortunately as soon as the popover is shown it forces the NSTokenField to resign first responder. Is there a way to show the popover but not to loose the first responder on the NSTokenField? Overriding NSTokenField's resignFirstResponder causes the NSTokenField to stop working (it doesn't accept any keystrokes). Overriding NSPopover's acceptsFirstResponder method or setting it's behaviour as suggested in this question does not work either. Edit: The NSTokenField is not inside the NSPopover's

How to open a NSPopover at a distance from the system bar?

£可爱£侵袭症+ 提交于 2019-12-01 00:27:11
I'm opening a NSPopover with the action of an icon in the status bar. myPopover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) This works fine with the exception that the distance from the popover and the system bar is zero: I'd like to achieve the same result as the Dropbox app which renders the popover at a small distance from the system bar: I've tried using button.bounds.offsetBy(dx: 0.0, dy: 20.0) which doesn't affect the position of the popover and button.bounds.offsetBy(dx: 0.0, dy: -20.0) which puts the popover above the system bar: So how can I position

How to open a NSPopover at a distance from the system bar?

半世苍凉 提交于 2019-11-30 16:09:49
问题 I'm opening a NSPopover with the action of an icon in the status bar. myPopover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) This works fine with the exception that the distance from the popover and the system bar is zero: I'd like to achieve the same result as the Dropbox app which renders the popover at a small distance from the system bar: I've tried using button.bounds.offsetBy(dx: 0.0, dy: 20.0) which doesn't affect the position of the popover and button

Not being able to edit NSTextField on NSPopover even though Editable behavior is set

∥☆過路亽.° 提交于 2019-11-26 20:22:14
I have an application, which open popover with NSTextField . The text field is not editable. Behavior for text field is set to Editable . I still can paste and copy text to this field but i can't edit it. Anyone knows, what can be wrong? Balazs Toth Not sure if you still need the answer, but there may be some others still looking. I found a solution on apple developer forums. Quoting the original author: The main problem is the way keyboard events works. Although the NSTextField (and all its superviews) receives keyboard events, it doesn't make any action. That happens because the view where