nswindow

center programmatically created window

廉价感情. 提交于 2021-02-18 05:32:29
问题 I've been using the example from here to create a custom titlebar-less window: Drawing a custom window on Mac OS X I've found this is the only way i can create a titlebar-less window in Leopard, Snow Leopard and Lion, other methods don't work right either on Leopard or Lion. (If i try to invoke a titlebar-less window via normal NSWindow and IB, it won't start up in Leopard anymore) So far this custom titlebar-less window works great everywhere, but i can't center it, only a hard fixed

Swift NSWindow shows up and disappears immediately

家住魔仙堡 提交于 2021-02-08 04:57:17
问题 I'm a complete beginner to Swift, so this may be a silly question, but I can't figure out how this works... I have a view with a button inside which calls the following code: let window = NSWindow() window.center() window.title = "test" window.makeKeyAndOrderFront(self) When I click the button the window opens just for a moment and disappears a few milliseconds later. Can anyone help me with that? It seems I have a quite serious misunderstanding about views in Cocoa ;-) Thanks Tom 回答1: The

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

Allow an NSWindow (NSPanel) to float above full screen apps

 ̄綄美尐妖づ 提交于 2021-02-06 12:48:26
问题 I'm trying to add a little window that provides "quick input" from any place in the system to the main app. The user could hit a hotkey, the window pops up, and floats above all other windows. For the most part, this isn't much of a problem. I can configure an NSWindow to be: level = Int(CGWindowLevelKey.TornOffMenuWindowLevelKey.rawValue) collectionBehavior = .CanJoinAllSpaces I can also make it an NSPanel with NSNonactivatingPanelMask option set. The only problem is: how can I make it so

NSWindow automatically closes after showWindow

淺唱寂寞╮ 提交于 2021-02-05 09:47:45
问题 I'm trying to open a NSWindow inside a Storyboard. I've instantiated the controller correctly, the window opens but disappears instantly. var sb : NSStoryboard? var vc : NSWindowController? @IBAction func openWindow(sender: AnyObject) { let sb = NSStoryboard(name: "NewStoryBoard", bundle: nil) let vc = sb.instantiateControllerWithIdentifier("windowController") vc.showWindow(nil) } I would understand this behavior if the vars would be inside the func. In this case ARC would kill the window. In

Click on button i.e. .Activated not invoked once OrderOut is called

回眸只為那壹抹淺笑 提交于 2021-01-29 19:24:07
问题 The Button.Activated or Button's Action is not getting called for some reason, which I can not find. The code goes like this. In the ViewController's constructor: _whenActivated = this.WhenActivated(x => SetupBindings(x)); Then have a methods: private void SetupBindings(CompositeDisposable disposables) { this.BindCommand(ViewModel, vm => vm.ContinueCommand, v => v._loginButton) .DisposeWith(disposables); Observable.FromEventPattern( h => _cancelButton.Activated += h, h => _cancelButton

SwiftUI macos NSWindow instance

血红的双手。 提交于 2021-01-01 04:17:45
问题 Using xcode 12.3 and swift 5.3 with the SwiftUI App Life cycle to build a macOS application, what is the best way to access and change the appearance and behaviour of the NSWindow ? Edit: What I'm really after is the NSWindow instance. I've added an AppDelegate , but as I understand it the NSWindow is likely to be nil , so unavailable for modification, and simply creating one here similar to the AppKit App Delegate Life cycle method results in two windows appearing at launch. One solution

OSX - Disable Fullscreen Mode from the zoom button?

删除回忆录丶 提交于 2020-12-30 05:36:07
问题 I'm looking for either a setting option of NSWindow in XIB editor or via programmatically take I can disable the fullscreen mode feature in OS X when the user clicks the zoom button (green traffic light), as it does not work well with my UI design. (Instead, use it for normal window zooming.) Anyone can give me some hints where to look for? 回答1: Here's what I figured out. To change the behavior of the zoom button to normal window zooming (not by hiding the button), change the window to "

OSX - Disable Fullscreen Mode from the zoom button?

China☆狼群 提交于 2020-12-30 05:35:09
问题 I'm looking for either a setting option of NSWindow in XIB editor or via programmatically take I can disable the fullscreen mode feature in OS X when the user clicks the zoom button (green traffic light), as it does not work well with my UI design. (Instead, use it for normal window zooming.) Anyone can give me some hints where to look for? 回答1: Here's what I figured out. To change the behavior of the zoom button to normal window zooming (not by hiding the button), change the window to "