nswindowcontroller

Open NSWindowController from NSMenu

微笑、不失礼 提交于 2020-01-13 11:52:37
问题 I'm with a NSMenu in an agent application (without the icon in the dock) . When a button from this menu is tapped, I want to show a generic NSWindowController. My menu button action: - (IBAction)menuButtonTapped:(id)sender { MyWindowController *myWindow = [[MyWindowController alloc] initWithWindowNibName:@"MyWindowController"]; [myWindow showWindow:nil]; [[myWindow window] makeMainWindow]; } But the window just "flashes" in the screen (it shows and disappears really fast). Any solution? 回答1:

Open NSWindowController from NSMenu

∥☆過路亽.° 提交于 2020-01-13 11:52:14
问题 I'm with a NSMenu in an agent application (without the icon in the dock) . When a button from this menu is tapped, I want to show a generic NSWindowController. My menu button action: - (IBAction)menuButtonTapped:(id)sender { MyWindowController *myWindow = [[MyWindowController alloc] initWithWindowNibName:@"MyWindowController"]; [myWindow showWindow:nil]; [[myWindow window] makeMainWindow]; } But the window just "flashes" in the screen (it shows and disappears really fast). Any solution? 回答1:

Is it proper to archive/unarchive NSWindowController?

☆樱花仙子☆ 提交于 2020-01-06 05:01:40
问题 I'm having a difficult time understanding what's going wrong. I have an NSWindowController with a NSWindow and a NSTextView. I want to archive that NSWindowController and NSWindow (along with all of its controls) to a file. Then, I want to unarchive that same NSWindowController and the NSWindow and all views from the file. But Apple docs say: Note: Although the NSWindow class inherits the NSCoding protocol from NSResponder, the class does not support coding. Legacy support for archivers

Why isn't my sheet attached to the window it's run for?

ぐ巨炮叔叔 提交于 2019-12-31 17:53:00
问题 I have a NIB which contains two windows, one is the app's main window visible at launch and the other is a custom sheet (and therefore not visible at launch). When the sheet is required my controller calls: [NSApp beginSheet: sheetWindow modalForWindow: mainWindow modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: nil]; which displays the sheet window and starts a modal session, but the window has a standard Aqua title bar, is not 'connected' to

NSWindow flip animation (easy and universal)

人盡茶涼 提交于 2019-12-31 04:54:05
问题 How to make flip animation for OS X application windows without complex coding? 回答1: Finally, I did it. I have created object that work with NSWindowController objects instead of NSWidows. ALWindowFlipAnimator.h #import <Foundation/Foundation.h> //............................................................................................................ // Shorten macroes: #define FLIPANIMATOR [ALWindowFlipAnimator sharedWindowFlipAnimator] //.................................................

Set NSWindow Size programmatically doesn't work

这一生的挚爱 提交于 2019-12-25 04:19:49
问题 I'm new to macOS and have a very simple project with just one label in the ViewController. In the WindowController I'm trying to set the size of the window with that code: import Cocoa class WindowController: NSWindowController { override func windowDidLoad() { super.windowDidLoad() if let window = window, let screen = NSScreen.main { let screenRect = screen.visibleFrame print("screenRect \(screenRect)") window.setFrame(NSRect(x: screenRect.origin.x, y: screenRect.origin.y, width: screenRect

Weird issue with NSWindowController and ARC

Deadly 提交于 2019-12-24 08:57:41
问题 OK, here's a weird situation I'm facing : I've got an NSWindowController subclass, a window in myMainWindow.xib and the AppDelegate.m invoking the NSWindowController like this : myWindowController* controller = [[myWindowController alloc] initWithWindowNibName:@"myMainWindow"]; [controller showWindow:self]; Now here's what : When ARC is set to NO , then the app runs fine and the windows shows up ok, too. When I set ARC to YES - immediately after I set it (and for JUST 1 run) - it shows a

Swapping views - NSWindowController and NSViewController(s)

做~自己de王妃 提交于 2019-12-24 07:38:01
问题 I'm very new in Mac OS programming. At the moment I'm trying to create simple measurement application which will have one window with the toolbar at the top and the appropriate view in the bottom. Clicking button in the toolbar should result in switching view below it - e.g. clicking on the "Connection" button will show with connection settings, "Measurements" will show current data from the device. The problem is - I don't know how to handle swapping views, maybe in other words - something I

NSWindowController: loadWindow loads window from nib but showWindow: does nothing

我的未来我决定 提交于 2019-12-24 01:19:58
问题 I have an NSWindowController subclass called _PreferencesWindowController with the following implementation - @synthesize window; - (id)init { self = [super initWithWindowNibName:@"PreferencesWindow"]; if (!self) return nil; return self; } And I tried to show the window in _PreferencesWindowController by using the following code - _preferencesWindowController = [[_PreferencesWindowController alloc] init]; [_preferencesWindowController showWindow:nil]; It does nothing, and I checked

Disable bringing app window to front. After closing another window

谁说胖子不能爱 提交于 2019-12-23 22:10:28
问题 I have OSX App that contains 2 NSWindowControllers. My problem is described by few steps: Launch the app with 2 windows Select the window of another app Put 1 of the windows in front of anther app window and the second will stay in the bottom. Close the window in the top. The second window will be brought to the top immediately.(I need to fix it and keep my second window in the bottom.) Also I hope to cancel this behavior. Not just make an opposite action like NSApp.hide()/NSApp.deactivate