nspopover

NSPopOver & NSViewController - Drag to resize

﹥>﹥吖頭↗ 提交于 2019-12-07 10:17:10
问题 I am making a MenuBar app for which I am using NSPopOver . The problem is that NSPopover uses NSViewController as a contentViewController , whose size gets fixed. My requirement is to make the size of NSViewController flexible i.e just like NSWindowController (set the minimum size and maximum depends upon the total screen size). In simple words how to change the size of NSViewController(NSPopOver) when user drags it. I am new to OS X programming. 回答1: I finally got it working by using Mouse

Resizing nspopover

匆匆过客 提交于 2019-12-07 00:49:34
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. There's a setContentSize on the popover, but I have the impression this doesn't work so well. I mean it works, but resizes the content (including child views). So the better way is to create a new NSViewController and assign

Xcode Swift OS X popover behavior

半腔热情 提交于 2019-12-06 17:43:16
问题 For my small Mac menubar application I'd like the behavior of the popover to be transient, so when it loses focus, it will close. This works for that: popover.behavior = NSPopoverBehavior.Transient But it only works once, so the second time you click somewhere else the popover stays. I placed the code in func applicationDidFinishLaunching(notification: NSNotification) , but placing it outside this function inside the class did not work. How can I use force this behavior all the time? I am

NSStatusItem with NSPopover and NSTextField

夙愿已清 提交于 2019-12-06 10:23:49
问题 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

NSTextField inside NSPopover is not key until mouse click

a 夏天 提交于 2019-12-06 09:22:32
I've got an NSPopover that is shown from interaction with an NSStatusItem. I've blogged about the hacks I needed to do to make input even possible in this situation here: http://blog.brokenrobotllc.com/using-nspopover-with-nsstatusitem I have an NSTextField inside the NSPopover's content view. When I open the NSPopover, the NSTextField appears as if it is key (the cursor blinks). But, when typing, nothing shows up. If I click the mouse in the field, my input starts showing up there. I've tried things like invoking NSWindow's makeFirstResponder upon popoverDidShow:. There was no change in

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

点点圈 提交于 2019-12-06 08:47:14
问题 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? 回答1: Outlets to view

Getting access to NSPopover window to set level?

牧云@^-^@ 提交于 2019-12-06 00:09:56
问题 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 ? 回答1: 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

NSPopOver & NSViewController - Drag to resize

﹥>﹥吖頭↗ 提交于 2019-12-05 16:16:10
I am making a MenuBar app for which I am using NSPopOver . The problem is that NSPopover uses NSViewController as a contentViewController , whose size gets fixed. My requirement is to make the size of NSViewController flexible i.e just like NSWindowController (set the minimum size and maximum depends upon the total screen size). In simple words how to change the size of NSViewController(NSPopOver) when user drags it. I am new to OS X programming. I finally got it working by using Mouse Events . Just need to monitor the override func mouseDown(theEvent: NSEvent) {} override func mouseDragged

Xcode Swift OS X popover behavior

本秂侑毒 提交于 2019-12-04 21:09:51
For my small Mac menubar application I'd like the behavior of the popover to be transient, so when it loses focus, it will close. This works for that: popover.behavior = NSPopoverBehavior.Transient But it only works once, so the second time you click somewhere else the popover stays. I placed the code in func applicationDidFinishLaunching(notification: NSNotification) , but placing it outside this function inside the class did not work. How can I use force this behavior all the time? I am using Xcode 7.0 with Swift (2.0). You better leave the behaviour to the default value which is

NSPopover - Hide when focus lost? (clicked outside of popover)

♀尐吖头ヾ 提交于 2019-12-04 17:10:04
问题 I'm using the doubleClickAction of a NSTableView to display a NSPopover . Something like this: NSInteger selectedRow = [dataTableView clickedRow]; NSInteger selectedColumn = [dataTableView clickedColumn]; // If something was not selected, then we cannot display anything. if(selectedRow < 0 || selectedColumn < 0) { NSLog(@"Invalid selected (%ld,%ld)", selectedRow, selectedColumn); return; } // End of something was not selected // Setup our view controller, make sure if there was already a