nspopover

Cut/copy/paste keyboard shortcuts not working in NSPopover

孤街醉人 提交于 2021-01-28 08:03:46
问题 I have a macOS NSPopover based tray app which shows a popover with login fields (username and password). Problem is that user is unable to copy-paste his email or password into text fields. The popover doesn't seem to allow keyboard shortcuts for some reason. Did anyone have similar issues? Relevant example available here: https://github.com/mixtly87/NSPopoverTest 回答1: This isn't the easiest thing to solve and you need to do a few things to get this to work. 1 ) add a MainMenu to your

How to deal with first responder and a NSPopover

爷,独闯天下 提交于 2020-01-31 08:57:50
问题 I’m trying to replicate the behaviour of the search field in iTunes, for looking up stock symbols and names. Specifically, as you start typing in the search field a popover appears with the filtered items. For the most part I have this working however what I can’t replicate is the way it handles first responder I have my popover appear after three characters are entered. At this point the NSSearchField would lose first responder status and therefore I could no longer continue typing. The

How to deal with first responder and a NSPopover

淺唱寂寞╮ 提交于 2020-01-31 08:56:12
问题 I’m trying to replicate the behaviour of the search field in iTunes, for looking up stock symbols and names. Specifically, as you start typing in the search field a popover appears with the filtered items. For the most part I have this working however what I can’t replicate is the way it handles first responder I have my popover appear after three characters are entered. At this point the NSSearchField would lose first responder status and therefore I could no longer continue typing. The

Animating Auto Layout changes concurrently with NSPopover contentSize change

99封情书 提交于 2020-01-01 03:27:04
问题 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

NSView inside an NSPopover: Converting Coordinates

别说谁变了你拦得住时间么 提交于 2019-12-24 16:30:02
问题 Context Let P be an NSPopover and view be an NSView that is a subview contained within P . What I Need I want to take the frame of view and convert it to the screen's coordinate system. Normally, you would do that like this: NSRect frameRelativeToWindow = [self convertRect:self.frame relativeToView:nil]; [self.window convertRectToScreen:frameRelativeToWindow]; However, because view is in an NSPopover, its window property is nil and the above method will return NSZeroRect: [0, 0, 0, 0] So, how

NSPopover in NSCollectionView (or not)

强颜欢笑 提交于 2019-12-24 02:55:14
问题 I have a custom subclass of NSView that is used in an NSCollectionView . The view shows a NSPopover when it is double clicked using the code below: - (void)mouseDown:(NSEvent *)theEvent { [super mouseDown:theEvent]; if ([theEvent clickCount] == 2) { [popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge]; } } popover is an IBOutlet (yes it's connected). This works fine when the view is placed in a window normally, but when the view is in the collection view, it doesn't

Resizing nspopover

老子叫甜甜 提交于 2019-12-23 02:45:57
问题 I am trying to resize an NSPopover prior to displaying it by setting the frame of the NSView it contains using the method: setFrameSize: However, when I try to display the popover by calling: showRelativeToRect: ofView: preferredEdge: The view returns to its previous size. Why is this happening? Is there another way I should be sizing the popover? Thanks in advance, Ben. 回答1: There's a setContentSize on the popover, but I have the impression this doesn't work so well. I mean it works, but

NSPopover below caret in NSTextView

烈酒焚心 提交于 2019-12-21 03:12:19
问题 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}} ). 回答1: I'm not sure if you are still looking for

Force NSPopover to not become first responder with NSTokenField

て烟熏妆下的殇ゞ 提交于 2019-12-21 02:34:49
问题 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

Can't disable background blur with NSPopover

陌路散爱 提交于 2019-12-20 04:24:34
问题 I'm having no luck trying to get NSPopover back to its 10.9 appearance when running in 10.10. I have a popover which is attached to an NSView that the user drags around. The popover must be transparent so the user can still see the position of the other UI elements underneath. All works fine under 10.9 but now under 10.10 with Apple's new gimmicky blurs, I can't seem to get back to the same appearance on 10.10 (unless like me, the user has enabled "Reduce Transparency" in System Preferences >