nswindowcontroller

How to prevent multiple instances of the same window from opening in macOS?

对着背影说爱祢 提交于 2021-02-08 06:35:37
问题 I am making a Mac Menu Bar app and it has a Preferences option. When the user clicks on it, a Preferences window opens up that shows all the settings for the app. I open the Preferences window like: let storyboard = NSStoryboard(name: "Main", bundle: nil) let windowController = storyboard.instantiateController(withIdentifier: "PreferencesWindowController") as! NSWindowController windowController.showWindow(self) File: AppDelegate.swift (above code is run when user clicks on "Preferences") Now

Show Window without activating (keep application below it active)

こ雲淡風輕ζ 提交于 2021-02-07 13:10:05
问题 I need to show a window (without title bar) above third party applications without my window taking focus. I have tried using an NSPanel and setting enabling non-activating, but that didn't help. I tried orderFront:self , but that didn't help either. I always needed to add [NSApp activateIgnoringOtherApps:YES]; because the window wouldn't show otherwise. I have here a sample project for just this functionality: http://users.telenet.be/prullen/TopW2.zip UIElement is set to true in the

Show Window without activating (keep application below it active)

妖精的绣舞 提交于 2021-02-07 13:07:13
问题 I need to show a window (without title bar) above third party applications without my window taking focus. I have tried using an NSPanel and setting enabling non-activating, but that didn't help. I tried orderFront:self , but that didn't help either. I always needed to add [NSApp activateIgnoringOtherApps:YES]; because the window wouldn't show otherwise. I have here a sample project for just this functionality: http://users.telenet.be/prullen/TopW2.zip UIElement is set to true in the

Can't use storyboard custom instantiated window controller

百般思念 提交于 2020-05-22 07:48:18
问题 I am getting what feels like a bug when trying to custom instantiate a window controller from a storyboard. I am using NSStoryboard.instantiateController(identifier: creator: ), which is a new function as of MacOS 10.15. The block of code in question is: Let mainWindowController = storyboard.instantiateController(identifier: "Analysis Window Controller") { aDecoder in MainWindowController(coder: aDecoder) } I have SUCCESSFULLY used basically this exact code for custom instantiating the main

Can't use storyboard custom instantiated window controller

流过昼夜 提交于 2020-05-22 07:47:30
问题 I am getting what feels like a bug when trying to custom instantiate a window controller from a storyboard. I am using NSStoryboard.instantiateController(identifier: creator: ), which is a new function as of MacOS 10.15. The block of code in question is: Let mainWindowController = storyboard.instantiateController(identifier: "Analysis Window Controller") { aDecoder in MainWindowController(coder: aDecoder) } I have SUCCESSFULLY used basically this exact code for custom instantiating the main

How to close window (NSWindowController) by hitting the ESC key?

拟墨画扇 提交于 2020-02-23 08:01:39
问题 Issue I would like the user being able to close a window by hitting the ESC key but I can't get it to work in this specific case, hitting ESC triggers an error sound (the "no you can't do that" macOS bloop) and nothing happens. Context I'm making a subclass of NSWindowController which itself creates an instance of a subclass of NSViewController and sets it in a view. Both controllers have their own xib file. NSWindowController: final class MyWindowController: NSWindowController,

How can I set the title of non-main-windows in an NSDocument application?

你。 提交于 2020-02-02 11:09:12
问题 I am working on a document-based OSX application, with master-detail style windows. I understand how to open additional windows, to display additional information, by using -makeWindowControllers and adding extra window controllers, but I can't set the title of the new windows. I have tried using -setTitle and -windowTitleForDocumentDisplayName in both Document.m and in my sub-classed window controller class, but I can't get the window title to change. How do I change the title of non-main

Connect Window Controller Outlet to Window

余生颓废 提交于 2020-01-31 05:32:46
问题 I am trying to create a simple modal dialog in XCode 4. I have created the xib, created the NSWindowController derived class and made it the class in the File's Owner of the xib. The part I am having trouble with is physically connecting the window outlet as mentioned in the answers to questions: How to give focus to NSWindow loaded from NIB? Why do I have to call showWindow on my NSWindowController twice on 10.5? and in Apple documentation here: http://developer.apple.com/library/mac/

Connect Window Controller Outlet to Window

假如想象 提交于 2020-01-31 05:32:06
问题 I am trying to create a simple modal dialog in XCode 4. I have created the xib, created the NSWindowController derived class and made it the class in the File's Owner of the xib. The part I am having trouble with is physically connecting the window outlet as mentioned in the answers to questions: How to give focus to NSWindow loaded from NIB? Why do I have to call showWindow on my NSWindowController twice on 10.5? and in Apple documentation here: http://developer.apple.com/library/mac/

Window is not releasing when switching to another window

二次信任 提交于 2020-01-17 04:45:13
问题 I am creating a Mac application in which I have mainwindow with some buttons. When I click button it will open a DetailWindow with NSTableview. Every buttonclickevent change the data in NSTableView. Here is my code: In my mainWindow.m FIle - (IBAction)btn1Event:(id)sender { if (!detailwindow) { detailwindow = [[DetailWindow alloc] initWithWindowNibName:@"DetailWindow"]; detailwindow.mainwindow = self; } detailwindow.title = @"First"; [detailwindow showWindow:self]; } - (IBAction)btn2Event:(id