nswindowcontroller

deminiaturize NSWindow without making it key

感情迁移 提交于 2019-12-23 04:58:16
问题 I have main window and several child windows, i would like to show main window when user click on dock icon, but without making it a key window, if there just was one (it will become automatically key if there is no key window). Here is current code: if ( fMainWinDelegate ) { if (not [NSApp keyWindow]) { NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate showWindow]"); [fMainWinDelegate showWindow]; } else { if ([fMainWinDelegate.window isMiniaturized]) { NSLog(@"AppDelegate

How to get notified when NSWindow closes

天大地大妈咪最大 提交于 2019-12-22 02:20:26
问题 how can I take notice when an NSWindow should or will get closed? I'd like to have something like the windowWillClose. Unfortunately NSWindowController does not have as much convenient methods as UIViewController has, for example. So what's the best practice to do that? Thanks –f 回答1: According to the NSWindow docs, a window will post a NSWindowWillCloseNotification notification when it is about to close. Your controller can observe this notification. 来源: https://stackoverflow.com/questions

How show sheet loaded from xib? (MacOSx)

谁说我不能喝 提交于 2019-12-21 17:55:20
问题 I have a xib file with only an NSPanel in it, I'm trying to show this panel as modal sheet (with beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: ). The file's owner for this xib is a controller class "MyController" which has the IBOutlet to the NSPanel. What I am looking for is something like: ... MyController *controller = [[MyController alloc] init]; [NSApp beginSheet:controller.panel modalForWindow:[NSApp mainWindow] modalDelegate:controller didEndSelector:nil

NSWindowController/NSViewController “Presentation” setting in Storyboard

≡放荡痞女 提交于 2019-12-21 07:02:16
问题 What exactly does the Presentation option(in Attribute Inspector) do in StoryBoard for Cocoa. It gives two options to select from Single Multiple P.S When googled the title, results are related to powerpoint presentation 回答1: The presentation style affects "Show" segues. Possibly it affects other segues too, but I only tested a Show segue. I tested on OS X 10.10.5 (Yosemite) with Xcode 7.1.1. If a window controller's presentation style is "Multiple" (the default), then a Show segue to the

NSWindowController's window released immediately

别说谁变了你拦得住时间么 提交于 2019-12-19 09:26:49
问题 I'm trying to open a window using a NSWindowController in my app delegate. I created a basic NSWindowController with an associated NIB and try to show the window that way: @implementation MyAppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Show the main window from a separate nib MyWindowController * theWindowController = [[MyWindowController alloc] initWithWindowNibName:@"MyWindowController"]; [theWindowController showWindow:self]; } @end When I launch

Pass an NSMutableArray to a NSWindowController

南笙酒味 提交于 2019-12-13 04:06:14
问题 So I am creating a NSWindowController like so: if ( summaryWindow ) { [summaryWindow release]; } // end if summaryWindow = [[SummaryWindowController alloc] init]; I am then passing this object an array that I will be using for a NSTableView [ summaryWindow setGlobalStatusArray:globalStatusArray]; Once that object is created, I realize I have don't know how to do something fundamental which is to link the newly created object actions and outlets. If I create a object in the xib, and link up

Setting NSWindow position in current screen

心不动则不痛 提交于 2019-12-12 17:00:25
问题 I am newbie in objective-c.I have created a main window which I want to display in the right bottom of the current screen. I tried the following code - (void)windowDidLoad { NSPoint pos; pos.x = [[NSScreen mainScreen] visibleFrame].origin.x + [[NSScreen mainScreen] visibleFrame].size.width - [mywindow frame].size.width ; pos.y = [[NSScreen mainScreen] visibleFrame].origin.y + [[NSScreen mainScreen] visibleFrame].size.height - [mywindow frame].size.height; [mywindow setFrameTopLeftPoint:pos];

NSWindowController can't capture ESC without WebView is added to the window

自作多情 提交于 2019-12-12 11:37:38
问题 I create a subclass of NSWindowController from File->New, and with the "With XIB for user interface" option checked. So I create 3 new files. Then I use Interface Builder to add exactly ONE view into the window. And have this code in MyWindowController.m: - (void)keyDown:(NSEvent *)theEvent{ NSLog(@"%@", theEvent); } First test, add one NSButton, and run the project. Second test, add one WebView(NSButton deleted), and run the project. In both tests, the window shows up correctly. But the

How do I open an NSSheet in Mavericks?

守給你的承諾、 提交于 2019-12-12 08:56:44
问题 In Mavericks, the methods to open and close NSSheets has changed. And to make it tougher, the Release Notes do not match the current documentation (see below). I'm trying to do this: MainSheetController (NSWindowController): -(IBAction)callSheet:(id)sender { [sheetController openSheet]; } SheetController (NSObject): (void)openSheet { [[NSBundle mainBundle] loadNibNamed:sheetName owner:self topLevelObjects:nil]; NSLog(@"1"); [self.mainWindowController.window beginSheet:self.sheet

OSX - Cocoa - Exception when closing a sheet

自古美人都是妖i 提交于 2019-12-11 20:07:38
问题 I am playing with using a sheet in my app. I have a little test project setup to find my way. I did have this code working: - (IBAction)activateSheet:(id)sender { if (!_sheet) [NSBundle loadNibNamed:@"Sheet" owner:self]; [NSApp beginSheet:self.sheet modalForWindow:[[NSApp delegate] window] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } but the loadNibNamed method is deprecated. So I substitute this: - (IBAction)activateSheet:(id)sender { if (!_sheet) NSLog(@"1"); [[NSBundle