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
9
votes
0 answers

Saving and restoring NSWindow state: can't restore firstRepsonder

I'm working on using encodeRestorableState/restoreStateWithCoder to save and restore the state of a window. (I'm doing this manually because I want to explicitly save my window state in the document and not just rely on the OS restoring its state as…
Uncommon
  • 3,323
  • 2
  • 18
  • 36
9
votes
5 answers

How to order a window to front if you are not in the Application in Objective-C

Is there a way to make a "makeKeyAndOrderToFront" without beeing in the Application? If I am in Safari and in the Menu Bar there is a MenuItem to my App, after I press this, i want to show a window of my App in the Front (makeKeyAndOrderToFront…
ahmet2106
  • 4,957
  • 4
  • 27
  • 38
9
votes
1 answer

how to get a window to receive drag and drop files in Xcode

i am trying to get drag and drop working in xcode 3.1.4 on osx/leopard. any pointers or hints or maybe even example code? i cannot find anything out there and it is really disappointing. i want to have the interface respond if files are dragged on…
z3cko
  • 3,054
  • 8
  • 40
  • 59
9
votes
1 answer

How to drag-move NSWindow with a NSImageView on its contentView?

I'm creating a mini window like the iTunes mini window: It's draggable and have a background image on it. Then I created a NSWindow's subclass and overrides its initWithContentRect:styleMask:backing:defer: method, and added an NSImageView to it: -…
OpenThread
  • 2,096
  • 3
  • 28
  • 49
9
votes
1 answer

Make NSWindow truly the highest level (above mouse, above mission control/expose)

I was wondering if it is possible to make my NSWindow show above absolutely everything. I current set the window level to CGShieldingWindowLevel using the code... [self setLevel:CGShieldingWindowLevel()]; ...and this does a great job for the most…
Atlas Wegman
  • 569
  • 2
  • 10
9
votes
1 answer

NSWindow is not receiving any notification when it loses focus

I have a custom NSWindow class that has the following methods: - (void)setupWindowForEvents{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignMainNotification object:self]; …
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
9
votes
3 answers

How to enable / disable the zoom button (green + button)?

I'm new in Mac OSx / Cocoa development. During the creation of my first app, I bumped into a few things, and one of which is my issue on the green + button which is intended for zooming purposes. I'd like to know if it is possible to dynamically set…
Kimpoy
  • 1,974
  • 3
  • 21
  • 38
9
votes
3 answers

keyDown not being called

I have a custom NSView called SurfaceView. It is the contentView of a NSWindow and it handles basic events like mouse click and drawing. But don't matters what I do, it does not handle the keyDown function. I've already override the…
user1467310
  • 542
  • 4
  • 9
9
votes
1 answer

How can I know NSWindow was closed using the close button ?

Is there an easy way to know when a NSWindow was closed using the close button (of the window title bar) . Using NSWindowDelegate and the windowWillClose:(NSNotification *)notification method I get notification of each closing. But how can I know…
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
9
votes
3 answers

Gracefully gain and resign background app focus for dialog

I am working on a small Mac application which will typically run invisibly in the background. However, the app's primary functionality comes into play when the user renames a file on their desktop or elsewhere in Finder. When this occurs, I would…
Alex Nichol
  • 7,512
  • 4
  • 32
  • 30
9
votes
3 answers

Overriding "Edited" in window title for NSDocument

How do I prevent a window title from displaying "Edited" for an NSDocument which is dirty? I'm managing saving and autosaving myself, using a web service, and just don't want the distraction in the title bar. I've tried overriding: NSDocument's…
paulmelnikow
  • 16,895
  • 8
  • 63
  • 114
8
votes
1 answer

Check if a sheet is open

I'm writing a Cocoa app and basically I have a window and I need to check if a sheet is open before I open another window. Google doesn't seem to know that one. How may I check if the sheet is open or not?
Fernando Valente
  • 1,096
  • 1
  • 8
  • 30
8
votes
2 answers

Put a transparent NSWindow permanently on top of another NSWindow

I want to have some UI controls on top of a NSWebView and because of this problem " https://stackoverflow.com/questions/9120868/video-in-nswebview-hides-views-on-top-of-the-nswebview " I now want to add a "transparent" NSWindow, so without the close…
Besi
  • 22,579
  • 24
  • 131
  • 223
8
votes
2 answers

Hide NSToolbar in fullscreen

I'm making a Cocoa app, with a hidden unified NSToolbar and Titlebar. I've done so by adding a toolbar in the Window Controller and setting all the options to make this invisible and keep the 3 colored buttons. It works great in a normal window, but…
Herlid
  • 105
  • 1
  • 9
8
votes
4 answers

Showing a modal NSWindow, without activating the other application windows

I have an NSStatusItem that is properly displaying in the MenuBar. One of the items (when clicked) displays a modal NSWindow from my application, which is meant to perform a one-off task, then disappear. (Eg. the user enters a small bit of text,…
Craig Otis
  • 31,257
  • 32
  • 136
  • 234