Questions tagged [nsalert]
126 questions
0
votes
2 answers
Why is it that after showing an NSAlert nothing works?
Why is it that after showing an NSAlert nothing works until I close the NSAlert?
I was trying to print a statement after the display of an NSAlert but print is not working.
Below I have attached my code:
let alert: NSAlert =…

Anup Gupta
- 1,993
- 2
- 25
- 40
0
votes
0 answers
How to make NSButton of NSAlert crops the text?
My NSAlert has 2 buttons. I changed the font of a button but its frame doesn't auto-resize to crops its text.
I have tried changing the frame of the button, use sizeToFits, set attribute title, ... but it didn't work.
How can I make the button to…

Hoang Anh Tuan
- 370
- 3
- 9
0
votes
0 answers
NSAlert not visible if open near screen edge in macOS Catalina
For windows located near the screen edges:
On some monitors (or computers) NSAlert opened as a sheet on a window moves the window to make the alert sheet visible. But on some others monitors (or computers) windows near the screen edge are not moved…

stapoz
- 1
- 2
0
votes
1 answer
NSAlertPanel not working when Application is quitting
Im trying to allow the user to decide whether to quit the application or not and Ive been trying to implement it using this:
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
int answer = NSRunAlertPanel(@"Quit",…

aayush sharma
- 187
- 9
0
votes
1 answer
Is it possible to use the alert Finder provides when moving a file to a directory where a file with that name exists in my own app?
I'm building a mac-app for people to organise files. One of the things I allow people to do is to move or copy files to specific directories from within my app. I use FileManagers 'moveItem(at:to:)' or 'copyItem(atPath:toPath:)' to do so, which also…

frankster5000
- 11
- 2
0
votes
0 answers
How to modify the size of the Accesory View in NSAlert?
Is it possible to modify the size of the accessory view on a NSAlert for Cocoa?
Let's say, in the image, INFORMATIVE TEXT is present, but if you remove it, is it possible to use that empty area in order to make the accessory view bigger (cyan area)…

Jeff
- 39
- 2
0
votes
0 answers
NSAlert keyboard event propagation
I wrote an app using Xcode 9.4 and Swift 4.1 for Mac OS X High Sierra. It has a custom NSView and a custom NSViewController. The custom NSView class has override functions defined for handling keyboard events (keyUp and keyDown). (It also has an…

user2132980
- 195
- 2
- 10
0
votes
1 answer
Show NSAlert on specific launches
I need to show an NSAlert on the 3rd, 10th and 20th launch of the app, so far I have tried:
/* Note that the kLaunchCount is incremented as a Number in a dictionary */
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"kLaunchCount"]…

WrightsCS
- 50,551
- 22
- 134
- 186
0
votes
1 answer
Adding Disclosure button and NSTextView to NSAlert
I want to display an NSAlert with basically an Accessory view. The Accessory view needs to have:
1) NSTexView for displaying mandatory contents
2) Disclosure button with NSTextView
The Disclosure button is required to hide and show the second…

user598789
- 329
- 1
- 2
- 17
0
votes
0 answers
How to use custom NSView to mimic NSAlert notification modal behavior?
In Xcode for macOS I need to have a view pop up modally and synchronously into action on top of (within but smaller than) the frame of the app's main window to handle a situation requiring the user provide data and press one of several buttons and…

Lor
- 141
- 10
0
votes
1 answer
Can an Xcode Source Editor Extension prompt the user for input?
Simple question. I've written an Xcode Source Editor Extension and as part of one of my commands, I have to prompt the user for input to know which option they want.
I'm hoping there's a simple way to present an alert, but I'm guessing that's not…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
0
votes
1 answer
NSAlert with NSTableview in it size issues
I have an NSAlert and I set its accessoryView to be an NSTableView. It works good with small-medium amounts of data, but when the row count is getting large, the tableview resizes instead of getting a scrollbar.
I would expect the table to only take…

Edged
- 29
- 5
0
votes
0 answers
Create an NSAlert without a view
I'm creating an Safari App Extension that communicates with native code in swift.
I'm sending a message to swift, and I want the native code to ask if user accept an action, like delete something.
I found this code:
`
func dialogOKCancel(question:…

David Grechi Döll
- 11
- 2
0
votes
0 answers
Set width of NSAlert Window
i use this code for show a nsalert message:
let alert = NSAlert()
alert.informativeText = "My Text"
alert.addButton(withTitle: "Button 1")
alert.addButton(withTitle: "Button 2")
alert.runModal()
is there a way to set the width value of the alert…

Trombone0904
- 4,132
- 8
- 51
- 104
0
votes
1 answer
How to prevent NSAlert from dismiss
How can I prevent a simple NSAlert from being dismissed?
F.ex., when the application launches, I show a NSAlert with a NSTextField included.
The user shall type in a password. Only if the password is correct, the user should be allowed to use the…

j3141592653589793238
- 1,810
- 2
- 16
- 38