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
1
vote
0 answers

Getting the path of ALL the files dropped onto a Mac's dock icon

I'm trying to use the NSApplicationDelegate and the openFiles method to try grabbing the path of a list of random files users would drop on my (Cocoa) App's dock icon. My solution works flawlessly when dragging single files or folders onto my app's…
Séverin
  • 465
  • 3
  • 14
1
vote
1 answer

Mac Widgets: NSApplication openURLs not called from widget

I am working on a widget for my existing Mac app. The problem I am running into is that when I add a Link from the widget to the main app, the method - (void) application: (NSApplication *)application openURLs:(NSArray *)urls isn't called…
Z S
  • 7,039
  • 12
  • 53
  • 105
1
vote
1 answer

How to create Cocoa app main menu application programatically

I am creating simple Cocoa application from scratch, just to learn the process. However I am not able to create Application Menu. I have this code: - (void)applicationDidFinishLaunching:(NSNotification *)notification { [self…
RuLoViC
  • 825
  • 7
  • 23
1
vote
2 answers

PYObjC NSWindow is NoneType?

window = NSApplication.sharedApplication().mainWindow() window.contentView().addSubview_(chart_view) The window was made in another section and appears fine but I get this: : 'NoneType' object has no attribute 'contentView' Does anyone…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
1
vote
2 answers

NSApplication responder chain for arrow keys

I have an NSTextField in my window and 4 menu items with key equivalents ←↑→↓. When the text field is selected and I press an arrow key, I would expect the cursor to move in the text field but instead the corresponding menu item action is…
Codey
  • 1,131
  • 2
  • 15
  • 34
1
vote
2 answers

How do I initialize a window in Objective-C?

For a Mac graphics application (not iPhone), I need something like a main method in Java, the first method that gets a program going. I've been looking at things like NSViewController and NSWindow object. I've looked around but can't find an answer…
user763381
  • 39
  • 2
1
vote
1 answer

How do I disable my application from participating in the ⌘+tab cycle on macOS?

I'm trying to write a small utility that attaches itself to the current main/key window. I've managed to make sure that the window cannot become key or main window, but it still shows up in the list of active applications when I use ⌘+tab. The…
Clearer
  • 2,166
  • 23
  • 38
1
vote
1 answer

Execute code before state restoration happens (macOs)

I'm writing a document-based application for Mac in Swift 4, which, according to my client needs, has to show a licensing window were the user will provide its license key. I show this window at the applicationWillFinishLaunching() method. While…
1
vote
1 answer

NSApplication Delegate Question

I was wondering if - (void)applicationWillTerminate:(NSNotification *)notification is still called when the system shuts down and the application is told to quit. I'm working on an agent that needs to perform some actions when quitting, but I'm not…
Pripyat
  • 2,937
  • 2
  • 35
  • 69
1
vote
1 answer

How do I run code when a user agent process terminates?

What I want I want a helper app user agent (LSUIElement in Info.plist is True) to add itself to the login items on terminate. The Problem I can't get any code to run before the helper app process terminates. My "add to login items" code runs…
John Gallagher
  • 6,208
  • 6
  • 40
  • 75
1
vote
1 answer

MacOS Application Class data with segue

I'm using Cocoa and Swift 3 to develop for MacOS. I am trying to use the following code to set a user defaults key (boolean) to true when a user clicks on a menu item, on the main menu. class app: NSApplication, NSApplicationDelegate { @IBOutlet…
Ckacmaster
  • 366
  • 1
  • 10
1
vote
1 answer

What does NSApp hide: actually do with the NSWindow instances?

I'm working on an NSWindow subclass and I'm running into some strange behavior that makes me question some of my assumptions about how windows work on Mac OS X. What precisely happens to NSWindow instances when [[NSApplication sharedApplication]…
Frank R.
  • 2,328
  • 1
  • 24
  • 44
1
vote
1 answer

Dragging Files to NSStatusItem

I was told that the application:openFile: delegate method for NSApp would allow my application to open files by dropping them into the dock, but does this also apply to NSStatusItems in the menu bar? I would like to know before trying to implement.
RandyD
  • 11
  • 1
1
vote
0 answers

Crash on native packaged Mac JavaFX application

I've got a JavaFX application I'm working on, it runs on Windows and Mac, I'm only seeing the issue on the Mac. I'm using JRE version 1.8.0_51. Basically, when I'm not doing anything, and my application is in the background, sometimes it'll crash…
Garry
  • 623
  • 1
  • 7
  • 11
1
vote
0 answers

Scrolling with Mouse-down & Space?

Is there any sample code or article/guide suggesting how to best implement a click+scroll feature as common in apps like Adobe XYZ, Pixelmator, ..: The user clicks in a view while holding down the Space key to scroll the view Should we just move…
ATV
  • 4,116
  • 3
  • 23
  • 42