Questions tagged [nsapplication]

NSApplication is the central class in Apple's AppKit framework.

The NSApplication class is the central class in Apple's AppKit framework (). It is responsible for starting the main run loop and provides the central framework for your application’s execution.

References:

178 questions
2
votes
1 answer

Cocoa: NSApp beginSheet sets the application delegate?

I am trying to display a custom sheet in my application, but I think I am doing something wrong. While everything seems to be working just fine, I have a rather odd side-effect. (which took hours to figure out). It turns out that everytime I display…
nrj
  • 1,701
  • 2
  • 22
  • 37
2
votes
0 answers

How do I create a nested run loop after -[NSAlert beginSheetModalForWindow:] that allows other events to happen but doesn't return until alertDidEnd:?

On Windows and GTK+ it is possible to have a fully nested run loop that can still pump events to windows that are not waiting for modal input. However, with Cocoa, all I see for NSAlert are -[NSAlert runModal], which affects all windows, and…
andlabs
  • 11,290
  • 1
  • 31
  • 52
2
votes
1 answer

Return focus to previous app's window after makeKeyAndOrderFront

I have a status bar menu app - it doesn't run in the Dock (UIElement is YES). After a user-defined period, it brings one of its window to the front (using makeKeyAndOrderFront). An NSTimer is set up to get rid of it after a few seconds - I close the…
Gavin Smith
  • 181
  • 10
2
votes
1 answer

How to make a Status Bar Application catch 'applicationDidResignActive:' with other Status Bar Apps?

Right now I'm developing a Status Bar Application and I need to know when the app loses focus, every time. So I am currently using applicationDidResignActive: for that but that's not catching when I open another Status Bar App's menu. How can I make…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
2
votes
1 answer

NSWorkspace launchApplication:showIcon:autolaunch: - how to check autolaunch flag?

I have implemented a login item as I was recommended in this post. In the helper app I launch the main app using NSWorkspace method launchApplication:showIcon:autolaunch:, sending YES to autolaunch parameter. The problem is in following: I need to…
pAK-76
  • 305
  • 3
  • 8
2
votes
1 answer

Subclass NSApplication in MonoMac

I need to subclass NSApplication in MonoMac to override the sendEvent (SendEvent in C# terms) method of NSApplication in order to receive media key events (Play, Pause, Next, Prev on Macbooks) as described here: Listening to mac keyboard play/pause…
Dynalon
  • 6,577
  • 10
  • 54
  • 84
2
votes
1 answer

about panel in menubar application is not frontmost when activated

I have an application that lives in the menubar, without a main menu or dock icon. I have a button that triggers [NSApp orderFrontStandardAboutPanel:sender];. When that button is clicked, sometimes, the About panel becomes frontmost. Other times,…
rick
  • 1,075
  • 4
  • 20
  • 29
2
votes
1 answer

How to handle Cocoa application termination properly?

So, here's my case : I'm developing a NON-standard document-based application and I want to handle the scenario of aborting the termination when there still are unsaved changes in any of the documents. My initial idea is : User tries to quit the…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
1
vote
0 answers

How to open a modal window inside a modal window

This code is called when a button is pressed in a modal window. The current window was made modal by using [NSApp runModalForWindow:[self window]] inside -(void)showWindow:(id)sender method. To open the new window I use the following code. It works…
the Reverend
  • 12,305
  • 10
  • 66
  • 121
1
vote
0 answers

NSApplication delegate: Determining the return from hibernate mode: - didWakeUp?

I'm currently wondering if it is possible, just like on iOS the somehow have a delegate called once OSX returns from hibernate mode, e.g. on opening the MacBook from sleeping? I had a look at the NSApplication delegates here: Apple…
Thomas Fankhauser
  • 5,039
  • 1
  • 33
  • 32
1
vote
1 answer

cocoa beginSheet: didEndSelector throwing an error

I'm loading a sheet into my main .xib, the sheet is a panel and I have no problem displaying the sheet or closing it but when I close it I am getting an error message: 2012-02-21 11:10:12.142 CollectionTest2[23277:10b] *** - [AppController…
PruitIgoe
  • 6,166
  • 16
  • 70
  • 137
1
vote
0 answers

Minimize-in-place - Do I need a custom framework

I want to create a system wide minimize-in-place feature that occurs when double-clicking the title bar of any visible window in layer 0. It seems that this would be a really simple feature to re-implement... When a title-bar is double-clicked,…
RGB World
  • 399
  • 1
  • 6
  • 19
1
vote
1 answer

Initiating systemStatusBar doesn't work in applicationDidFinishLaunching

My project is document-based, and the code to load a status menu is only executed if I put it under awakeFromNib. #import "StatusMenuAppDelegate.h" @implementation StatusMenuAppDelegate @synthesize window = _window; -(void)awakeFromNib { …
janeh
  • 3,734
  • 7
  • 26
  • 43
1
vote
1 answer

Fire up Cocoa GUI from C++ loop and also passing references

I have a problem... maybe a couple :) My team has written a client in C++ using Boost and CMake to take care of the platform dependent stuff. Works like a charm! ...sometimes :) Anyway the graphical interface for Windows is done but for Mac OS X it…
1
vote
1 answer

Cocoa Dock fires NSApplicationDidChangeScreenParametersNotification

When changing the dock position Cocoa is firing a NSApplicationDidChangeScreenParametersNotification: The problem is that as for Apple Docs, it should be raised only when Posted when the configuration of the displays attached to the computer is…
loretoparisi
  • 15,724
  • 11
  • 102
  • 146