nswindow

Custom NSStatusItem with custom view - Use NSWindow, NSView, custom NSMenuItem?

I'm trying to create a LSUIElement app that behaves like Spotlight, CoverSutra and other apps of that type. I managed to create a custom NSStatusItem, which popups up an NSWindow but the problem is that the app that currently has focus will the focus to my custom NSWindow. I've based myself on Matt Gemmell's example (http://mattgemmell....

Centering Windows on screen

Short and sweet: How can I tell Interface Builder to center a window on a user's screen? I've seen the positioning tool on the inspector, but eyeballing doesn't always land as squarely as I like. Is this something where I should switch over to Xcode and add something to the init or awakeFromNib methods? ...

How to center NSSegmentedControl

Hi, I've added an NSSegmentedControl to a pane on an horizontal split view on a normal window. I thought that adjusting the springs would make the segmented control centre itself automatically, but it doesn't. How can keep it centred? I was told to add an observer for when the parent view's frame changes, and manually adjust the positi...

Hotkeys? Key events?

Hi, I'm trying to make a window open when the user pressed Cmd + L but how can I make my controller object listen to that particular key combination? ...

click on the Menu bar item to show a window

Here's my code: if ([window isVisible]) { [NSApp activateIgnoringOtherApps:YES]; [window orderOut:nil]; return; } [NSApp activateIgnoringOtherApps:YES]; [window makeKeyAndOrderFront:nil]; return; but if the user clicks/changes the current window and then clicks on menu bar it will close the window. How do I stop that? ...

Why am I getting "does not support archiving" in my NSWindow subclass ?

Hi all - I have the following class: @interface SpWindow : NSWindow <NSCoding> { BOOL _editMode; SpBgView *bgView; } ... ... which I then call archive on. My encode method is as follows: - (void) encodeWithCoder:(NSCoder *)aCoder { NSLog(@"encodeWithCoder CALLED FOR SpWindow"); [super encodeWithCoder:aCoder]; NSLog(@"SpWind...

NSWindow does not respond to keystroke command-s

Hello, it may pre very simple, but cannot find it: I have three windows in three separate NIBs in my application. One is opened when a new document is opened, the other two can be opened from the program's window menu. The problem is: two windows (in them the one that is opened at the beginning) accepts the normal keystroke as for ex...

Cocoa HUD window - how to turn off topmost?

I've wrote some small cocoa app and it's main window has HUD style. The problem is - when I set HUD style Interface Builder automatically also sets Utility style - which make the main window topmost (always visible over every other windows). Is there a way to get HUD style panel/window but without making it topmost? ...

Changing a NSWindow view in code

I would like to have a detail view come in to focus when the user double clicks on a table view row. How would I change a window's view in code? ...

NSOpenPanel above a fullscreen NSWindow ?

Hi - I open a window with the following: NSRect screenRect = [[NSScreen mainScreen] frame]; [super initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; int windowLevel = CGShieldingWindowLevel(); [self setLevel:windowLevel]; ......

Only allow one NSWindow to be selectable until action is completed (Cocoa)

Hi all, I have a program with many windows open. I want all windows to be visible, but only one window can be interactable, until a certain event has occured. e.g. pressing a button. At the moment, I can still click another window, and interact with it, how do I only allow interaction with ONE window, until a certain event occurs? Ima...

Programmatically closing an NSWindow when it loses focus

I am making an image picker that will display an n by n grid of selectable button when the picker is popped up. This grid of buttons will be contained within an NSWindow but I would like for the window to be close automatically if the user clicks off the screen. Is there a flag that can be set so that when the window looses focus it wi...

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

Custom NSWindow drawing

I want to draw an NSWindow that looks similar to this: http://vibealicious.com/site/apps/notify/screenshots/mainUIFull.png In that it has a typical NSWindow appearance with the bottom bar and such, but instead of a title bar at the top, I want to draw a little arrow. Is there a simple way to do this? Do I have to draw the entire wind...

Stopping modal when window is closed (Cocoa)

Hello all, I am currently displaying a modal window by using this code: [[NSApplication sharedApplication] runModalForWindow:mainWindow]; However, when I close this window, the other windows are still inactive. How do I run the stopModal method when the window is closed using the "red x"? Thank you, Michael ...

Hide NSWindow title bar

Is there a way to hide the titlebar in an NSWindow? I don't want to have to completely write a new custom window. I can't use NSBorderlessWindowMask because I have a bottom bar on my window, and using NSBorderlessWindowMask makes that disappear. I also tried using setContentBorderThickness:forEdge: with NSMaxYEdge and setting it to 0, th...

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 the main window. ...

How to auto close modal window in Cocoa ?

I tried this but my program crashed. - (void)windowWillClose:(NSNotification *)notification { [modalWindow orderOut:self]; [NSApp stopModal]; } Thanks in advance. ...

NSWindow grow animation (Like the Quick Look Window)

What is the basic principles of doing complex animations on an NSWindow? I'd like to mimic the Quick Look window animation (grow/shrink) but haven't found anything on this. Animating views is well documented but nothing on NSWindow. If you look closely at the Quick Look window, you'll see that it doesn't change the frame size, but reall...

NSWindow Examples

What are some good NSWindow examples ? I want to start out by writing a simple program that has a window and 2 buttons. Clicking on each button loads a new window in the same view and displays the options. Another option I am considering is a tabbed view where user clicks on tabs and that window loads. I could not find any good tutorial...