Questions tagged [nsalert]
126 questions
5
votes
3 answers
NSAlert above NSPopover
I have an NSPopover which displays from an NSStatusItem. This Popover shows NSAlerts from time to time. The problem is these alerts always appear below the popover, even though they become the key window. Even if I drag it it's still below the…

Mark Bridges
- 8,228
- 4
- 50
- 65
4
votes
1 answer
How can I use NSAlert with no icon?
I want to use this method
- (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;
I found that NSAlert has this method. However, NSAlert will always come…

Chanok
- 790
- 6
- 23
4
votes
2 answers
AppleScript code that clicks a button in NSAlert
I have an mac application that once opened (in awakeFromNib) shows the user an NSAlert with two buttons, one with "Option1", the other with "Option2". I would like to automate the following flow:
Open the application from the Applications…

MaximD
- 186
- 2
- 6
4
votes
1 answer
How to create custom NSAlert Sheet Method with the Completion Handler paradigm
I have used this simple general method for a While and it works fine for App Based dialogs, however I would like the same functionality in a sheet style dialog and I am having a hard time getting one together.
According to the docs as I understand…

Miek
- 1,127
- 4
- 20
- 35
4
votes
1 answer
NSAlert Input Box, Validating NSTextField
I've run into a couple of topics that discuss an input box using NSAlert like the following.
- (NSString *)input: (NSString *)prompt defaultValue: (NSString *)defaultValue {
NSAlert *alert = [NSAlert alertWithMessageText: prompt
…

El Tomato
- 6,479
- 6
- 46
- 75
4
votes
2 answers
How can I use NSAlert without any icon?
I want to create a NSAlert with beginSheetModalForWindow, without any icon in alertstyle among NSWarningAlertStyle, NSInformationalAlertStyle, NSCriticalAlertStyle ?
Also if I use a functional API such as NSBeginAlertSheet,…

jkk
- 367
- 3
- 12
4
votes
6 answers
How to get focus ring off an NSAlert button?
Is there any way that you can take away the focus ring of the NSAlert button. Here is what I mean:
Here is my code:
[NSApp activateIgnoringOtherApps:YES];
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert…
user1445205
3
votes
1 answer
Do I need to retain the contextInfo for NSAlert alertDidEnd?
I need to pass an NSDictionary with a couple of options to
NSAlert - (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)modalDelegate didEndSelector:(SEL)alertDidEndSelector contextInfo:(void *)contextInfo
The docs don't say…

Mark
- 6,647
- 1
- 45
- 88
3
votes
1 answer
NSAlert: Make second button both the default and cancel button
Apple's original HIGs (now disappeared from the web site, sadly) stated that:
The rightmost button in the dialog, the action button, is the button that confirms the alert message text. The action button is usually, but not always, the default…

Thomas Tempelmann
- 11,045
- 8
- 74
- 149
3
votes
1 answer
How to get an NSStackView as accessory view to NSAlert?
I'm writing an app with Swift on macOS.
I want to create an NSAlert with a vertical NSStackView that will let the user pick one out of N options. To do that, I hook up my NSStackView in the accessoryView property of my NSAlert, and for some reason…

BearOverflow
- 111
- 1
- 8
3
votes
2 answers
NSAlert - can you have a custom icon?
Is there a way to insert a custom icon in a NSAlert? I know you can have different prefabbealert styles but is it possible to cu

PruitIgoe
- 6,166
- 16
- 70
- 137
3
votes
2 answers
NSAlert's icon not displayed when using default value
According to documentation doing:
let alert = NSAlert()
alert.icon = nil
alert.runModally()
should render application's icon. But I get placeholder instead.

zuziaka
- 575
- 3
- 10
3
votes
2 answers
Check if NSAlert is currently showing up
I am using an NSAlert to display error messages on the main screen of my app.
Basically, the NSAlert is a property of my main view controller
class ViewController: NSViewController {
var alert: NSAlert?
...
}
And when I receive some…

Randy
- 4,335
- 3
- 30
- 64
3
votes
1 answer
NSImage returns nil even when png file is in Resource folder
I'm trying to load an image using NSImage imageNamed: method but i have no success
i have copied the image in the project folder: Project>Resources and added to the project using: "Add files to project ..."
NSImage* image = [NSImage…

Giquo
- 151
- 2
- 14
3
votes
1 answer
NSAlert resize window
I have several NSAlert dialogs with different text. I want to adjust the alert window width to the text, so that the text don't wrap. Therefore I use this code to calculate the width of the string:
NSSize size = [myString…

Lupurus
- 3,618
- 2
- 29
- 59