Questions tagged [nswindow]

an apple class that defines objects that manage and coordinate the windows an application displays on the screen

The NSWindow class defines objects (known as windows) that manage and coordinate the windows an application displays on the screen. A single NSWindow object corresponds to at most one onscreen window. The two principal functions of a window are to provide an area in which views can be placed and to accept and distribute, to the appropriate views, events the user instigates through actions with the mouse and keyboard.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html

1332 questions
14
votes
1 answer

Document sheet not responding to keyboard events

I think it's a first responder problem, but I'm not sure. I'm implementing an edit window for data in a table view. Very similar in concept to the UI for editing filter rules in Mail.app. I have an editing window that I attach to my primary window…
Flyingdiver
  • 2,142
  • 13
  • 18
14
votes
2 answers

How to show a window without stealing focus on macOS?

I was wondering how could spotlight floating with focus, and another window still has focus! I could easy make a window floating over all other window with window?.level = Int(CGWindowLevelForKey(.maximumWindow)),but I cannot let two windows both…
Seven
  • 203
  • 3
  • 7
14
votes
7 answers

OSX Application: how to make window maximized?

I am working on a mac application, and I like to make initial window be in maximized state, like when you are pressing green button with plus sign. I don't want it to be full screen.
13
votes
4 answers

How to know if a NSWindow is fullscreen in Mac OS X Lion?

I guess I should check if [NSApplication presentationOptions] contains NSFullScreenModeApplicationPresentationOptions, but how do I achieve that? EDIT: using [NSApplication presentationOptions] doesn't work as in my document-based app there might be…
Nickkk
  • 2,261
  • 1
  • 25
  • 34
13
votes
2 answers

Change to other space (MacOSX) programmatically

I am making a customised window (a NSWindow with NSBorderlessWindowMask) So far I have been able to handle dragging, resizing, cmd+click and even miniaturize with double click if allowed (see here) so my window resembles as much as possible to a…
nacho4d
  • 43,720
  • 45
  • 157
  • 240
13
votes
3 answers

Why NSWindow without styleMask:NSTitledWindowMask can not be keyWindow?

Problem: I have one window mainWindow and another childWindow added to mainWindow. childWindow is kind of WindowExt class. This class I define for catch method call [NSWindow becomeKeyWindow] that must be called after [childWindow makeKeyWindow]. If…
iruirc
  • 143
  • 1
  • 6
13
votes
3 answers

How to get a list of all open NSWindow from all running application?

Is there a way to get list of open or visible NSWindow from mac desktop?
Teo Choong Ping
  • 12,512
  • 18
  • 64
  • 91
13
votes
2 answers

How do I open an NSWindow and have the window selected and in focus?

I am trying to open a NSWindow using the following code: NSWindowController *window = [[NSWindowController alloc] initWithWindowNibName:@"MainWindow"]; [window showWindow:nil]; The window opens okay but the previous window is still the mainWindow…
Luke
  • 6,195
  • 11
  • 57
  • 85
13
votes
1 answer

Cocoa warning: NSWindow does not support utility styleMask 0x10

I have re-drawn the NSWindow, and now when I start my app there is a warning in the console that says NSWindow does not support utility styleMask 0x10. How can I get rid of this warning? Any idea? Thanks!
Blues Zhou
  • 306
  • 2
  • 16
12
votes
1 answer

The most elegant way of creating a fullscreen overlay on Mac OS X (Lion)?

I'm searching for the "best" way of creating a fullscreen overlay under Mac OS X. I want to create a transparent or semi-transparent overlay, which cares about mouse events and shows other input/output elements. This overlay should be above every…
tamasgal
  • 24,826
  • 18
  • 96
  • 135
12
votes
2 answers

Disable window stretching Cocoa?

How do I disable the stretching of the window at the bottom right? I would have to deal with auto-sizing and all that stuff, which would be unnecessary if I simply didn't allow the user to stretch the window size.
user762034
12
votes
2 answers

NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future

I am writing a Python program with two threads. One displays a GUI and the other gets input from a scanner and saves data in an online database. The code works fine on my raspberry pi but if I try it on my MacBook Pro (Catalina 10.15.2), I get the…
Nothing
  • 139
  • 1
  • 1
  • 4
12
votes
1 answer

Detect if the screen is being recorded on macOS

I'm looking for a way to detect if the screen is currently being recorded. Ideally, an event for when the recording starts/stops. Maybe some kind of distributed notification. My use-case is that I would like to hide my app's menu bar item while the…
Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
12
votes
8 answers

Center programmatically created window

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…
devilhunter
  • 321
  • 1
  • 4
  • 13
12
votes
3 answers

Closing Mac application (clicking red cross on top) and reopening by clicking dock icon

When I close my Mac application (by clicking red cross button on window top bar) the app icon stays in the dock at the bottom. Now this is normal behaviour. When user click on it again it does not fire up the application unless the user quits the…
Leo
  • 1,547
  • 3
  • 24
  • 40
1 2
3
88 89