nswindow

Cocoa NSWindow with 2 toolbars

Is there any way to have 2 toolbars in one NSWindow. Something like Pages. With one large on at the top, and a smaller one below that. ...

Cocoa window position anomaly

Hello everyone, I have a weird problem with positioning a window on screen. I want to center the window on the screen, but i don't know how to do that. Here's what i've got. The window is created from nib by the main controller: IdentFormController *ftf = [[IdentFormController alloc] initWithWindowNibName:@"IdentForm"]; [[ftf window] m...

Animate setContent of an NSWindow

Hi there. In the past I've been successfully able to fade in an NSWindow using the following code; if (![statusWindow isVisible]) { statusWindow.alphaValue = 0.0; [statusWindow.animator setAlphaValue:1.0]; } CAAnimation *anim = [CABasicAnimation animation]; [anim setDelegate:self]; [statusWindow setAnimations:[NSDictionary dic...

Custom NSWindow setAlphaValue and makeKeyAndOrderFront

Hi, I have a custom window (matt gemells Transparent Window class) and I need to change the window's alpha value to achieve a fade in/out effect and perform a "makeKeyAndOrderFront:". However this does not work. What I did: I imported the header: #import "TransparentWindow.h" Then tried: [TransparentWindow setAlphaValue:0.5]; [...

Maintaining position of content view after window resize?

I created an NSWindow object in IB which contains some textFields and buttons at the top and an NSTextView beneath them. I then reduced the window height so as to hide the textView from sight when the window is initially opened. What I'm trying to do is to resize the window height programatically (thus exposing the textView) if any data ...

NSSlider and Movable by Background Window

Hi, I have an NSSlider inside a view. That view is a subview of a view in my window. The window is movable by background and if I want to change the value of the NSSlider by dragging it around then my whole window will move. If I make my window unmovable by background then it works or if I put the NSSlider in the first view (not the sub...

Window 'onscreen' size puzzle

Okay, a REALLY fundamental question about window sizes here... If I create an NSWindow in IB, set its size to 216 x 144 points (exactly 3 inches by 2 inches) then print the window, it measures exactly what I set it to in IB. However, the onscreen display size measures approximately 156 x 105 points. What causes this, and is there any w...

Keeping window of another application active while still receiving mouse events from another app's window?

Is there a way to have my app's window receive keyboard and/or mouse events (i.e. user clicking on window's buttons) while still retaining focus to another, unrelated app? I've tried configuring my window at different levels, including [myWindow setLevel:NSPopUpMenuWindowLevel] to no avail. ...

Flipping a Window in Cocoa

How can I flip an NSWindow so I can press a button, and the window will "flip" like on Dashboard and the content view of the NSWindow changes. ...

Drawing custom NSWindow from images.

I've got some images (4 corners, a title bar (+ close button), a bottom bar and a fill) to make an NSWindow from. But I have no idea what to write in the drawRect: method to make it into an NSWindow. Where should I start? ...

NSWindow NSResizableWindowMask resize corner wrong place

Hello, if i use NSResizableWindowMask flag in my NSWindow the "resize corner glyph" is on the top right. I can resize when pointing on the lower right corner. I use a own created NSView with it, and set it as content view with setContentView method. I ' dont use a bottom bar. Any idea of what i'm doing wrong ? Thanks. ...

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

Hello, 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 makes this just if you are in the Application). Which way can I use? And how can I a...

Location of New Window after old window closed

I have an app that allows multiple windows. I have a strange bug where, if I repeatedly open and close windows, new windows are positioned lower and lower on the screen. I would expect this if I were keeping the windows open, but it seems that the OS X window tiling mechanism is unaware of when my windows are closing. Potentially re...

Cocoa: Creating a Window with a Variable Number of Interface Elements

Hi, I've a window that will have an unknown amount of text fields, determined by the content of a remote server. In high level terms, how should I go about this? Create a custom view or create an empty window with a backing NSWindowController and then add stuff to it when the window is opened? I've seen the examples on the O'Reilly Co...

NSDocument Subclass not closed by NSWindowController?

Okay, I'm fairly new to Cocoa and Objective-C, and to OOP in general. As background, I'm working on an extensible editor that stores the user's documents in a package. This of course required some "fun" to get around some issues with NSFileWrapper (i.e. a somewhat sneaky writing and loading process to avoid making NSFileWrappers for ev...

addSubview and autosizing

How does one add views to a window, so that the views are resized to fit within the window frame? The problem I'm making a sheet window containing 2 views, where only one of them is visible at a time, so it's important that the views have the same size as the window. My problem is that either view0 fits correctly and view1 doesn't or ...

How to use NSWindowDidExposeNotification

Hi, I am trying to update another windows when the one becomes visible. So I found the NSWindowDidExposeNotification and tried to work with it, so I wrote in my awakeFromNib: // MyClass.m - (void)awakeFromNib { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(me...

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 and in focus. I have tried the following code to force the main window and it doesn't wo...

Why does my NSWindow only receive mouseOver events the first time?

I have an application where a borderless window is shown and hidden, using orderOut and orderFront. When it is visible, I want the it to become the key window when the mouse moves over it. So far I've done this: In awakeFromNib I have set its first responder to itself. In the window's constructor I set accepts mouse events to YES. In t...

NSWindowController and isWindowLoaded

Hi, I have an NSWindowController and I initialize it like this; + (MyWindowController *) sharedController { static MyWindowController *singleton = nil; if (!singleton) singleton = [[self alloc] initWithWindowNibName: @"myWindow"]; return singleton; } and I show windows like this; [[MyWindowController sharedController] s...