nswindowcontroller

Why do I have to call showWindow on my NSWindowController twice on 10.5?

I've got a subclass of an NSWindowController that I'm using to load a window from a nib and show it on the screen. Below is the code that is called when I want to show the window. On 10.6 when showCustomWindow is called the window is displayed, but on 10.5 this method has to be called twice to get the window to display. -(IBAction)sho...

TextFields not loading in subclass of NSWindowController

I am working on a second preferences style panel (but preferences related to a specific document.) My myDocument file is getting a little large so I decided to try using a separate subclass WindowController for the implementation. I have subclassed NSWindowController. The nib file has myController as the owner. It implements both window...

Closing a document's window and opening a new one, without closing the document

My app is document-based, but the “document” consists of two folders, not one file. The document's initial window contains a couple of file pickers and a button; the action closes that window and opens a new one showing the results of the operation between the two folder hierarchies. (The two windows are significantly different in size; ...

Using NSWindowController to manipulate a window

I have the following code: AXWindowController *controller = [[AXWindowController alloc] initWithWindowNibName:@"ActivateWindow"]; [controller showWindow:nil]; How do I use controller to make changes to the window ActivateWindow (eg. changing text on the window, etc.)? Step by step instructions would be appreciated. Thanks! ...

How to use NSWindowController?

I'm looking in to using NSWindowController and I just can't think how to get it working. How do I start using it? ...

MVC in a Cocoa document-based application

I'm going through a refactoring and reorganization of my application at the moment. I've realized that some of the separation between models and views, and their controllers has diminished and I wish to do some cleaning up. I have several key classes used in my app: NSPersistentDocument, NSWindowController, and a model class. The NSPer...

When should I extend NSDocument and when should I extend NSWindowController?

I've an application that holds a main window with a list of items, and from that window an undetermined number of windows can be opened. Each of those windows can hold several instances of a model object, with those instances listed in a drawer. I started my project by making the (main window) list of items extend NSDocument and each ot...

Cocoa: Plugin Cannot Open App Window

Hi. I am developing an plugin for OsiriX. In that app i have 3-4 nib files. Also in for plugin there are files (.h & .m) called PluginFilter where method called - (long) filterImage:(NSString) menuName is present from which the plugin start execution. Now my problem is that, I have return the code to launch main window is in some o...

Cocoa Key event problem

I'm trying to build my first cocoa application. done some iPhone developing before. I have a hard time understanding how to layout my project. i making a Pong game and my current design is to allocate an NSWindowController from my appDelegate. I then use custom view to act as paddles and ball. My problem is that i can't get the window c...

Where should document-related actions for a Cocoa app be implemented?

I'm writing a document-based Cocoa app that's basically a graphical editing program. I want the user to be able to show/hide non-modal windows (such as an inspector window). Since these windows would be shown/hidden from menu items, where is the "best" place to implement the actions, such as - (IBAction)toggleInspector:(id)sender? I'v...

XIB-instantiated Object's IBOutlet is nil

I have a XIB set up like in this screenshot: File's owner is my main window controller. The XIB is also in charge of creating an object that serves as the delegate for the MGScopeBar view. As you can see in the screenshot, the scope bar delegate has an IBOutlet for the search field so that it can return it as an extra view as part of ...

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...

How to close a window (unload a NIB)?

I have a custom NSWindowController subclass that loads a NIB file during initialization like this: self = [super initWithNibNamed:@"myNib"]; if (self != nil) { [self window]; } The nib contains some custom views and some other controls. The NSWindowController is the file's owner and at least one of the views even binds to it. Sim...

NSWindowController windowDidLoad not called

I have a simple Cocoa app using a NSWindowController subclass. In the nib I have set: File Owner's class to my NSWindowController subclass The 'Window' outlet of the File's Owner to the main NSWindow in the nib. The init method of my NSWindowController subclass is called (I call super), but not matter what I do windowDidLoad is nev...

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...

Problem with setContentBorderThickness:forEdge: not actually setting the value

I'm trying to use setContentBorderThickness:forEdge: to create a bottom bar in a Cocoa application. mipadi was on to something, but in testing it out, I think maybe this is a slightly different problem: -(void) adjustContentBorderBasedOnArrayControllerSelection{ if(([[self.resultsArrayController selectionIndexes] count] == 0)){ ...

Access to the NIB window controls

I have inherited a new class from NSWindowController to implement windowDidLoad and then access to the NIB defined window controls: - ( void ) windowDidLoad { NSArray * controls = [ [ [ self window ] contentView ] subviews ]; int i; NSRunAlertPanel( @"windowDidLoad", @"", @"OK", NULL, NULL ); if( [ controls count ] == 0 ) ...

Breaking Down NSTabView Into Files

As my Cocoa app comes along, my NSWindowController is becoming huuuuuuuuuuge. My window has an NSTabView, and each tab therein has its own NSViewController (they all have submenus) and its own methods. So, my WindowController.m seems to stretch well beyond what it's supposed to because of tabs. Sadly, examples of NSTabView are quite sim...

NSWindowController: loadWindow loads window from nib but showWindow: does nothing

I have an NSWindowController subclass called _PreferencesWindowController with the following implementation - @synthesize window; - (id)init { self = [super initWithWindowNibName:@"PreferencesWindow"]; if (!self) return nil; return self; } And I tried to show the window in _PreferencesWindowController by using the following code...

NSWindowController clarification of understanding

Hi, I have used NSWindowController in projects several times, and feel like I have a (very)rough grasp of the concepts behind this important class. What I would like to do with this post is to clarify/correct my own understandings, and hopefully help other learners get that first step into understanding. It's the at-a-glance concepts, o...