Hi All!
I've been trying to wrap my head around how to convert my existing "display alert"'s to a sheet style NSAlert attached to the main window. I've found some helpful hints on the macscripter forum, but I'm stuck.
I have two issues:
1. Clicking the Default Button in the alert panel returns a EXC_BAD_ACCESS
2. None of the buttons seem to send a returnCode as an integer. I'd like to be able to do something different depending on which button was pressed. This all seems pretty straight forward, but I'm at a loss.
Here's the code I've been playing with:
Any help would be GREATLY appreciated. Please let me know if there's anymore info I can provide.
Thanks so much!!!
I've been trying to wrap my head around how to convert my existing "display alert"'s to a sheet style NSAlert attached to the main window. I've found some helpful hints on the macscripter forum, but I'm stuck.
I have two issues:
1. Clicking the Default Button in the alert panel returns a EXC_BAD_ACCESS
2. None of the buttons seem to send a returnCode as an integer. I'd like to be able to do something different depending on which button was pressed. This all seems pretty straight forward, but I'm at a loss.
Here's the code I've been playing with:
Code:
property parent : class "NSObject"
property mainWindow : missing value
property alertWindow : class "NSAlert"
on showAlert_(sender)
set theAlert to alertWindow's alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_("An alert", "OK", "Cancel", missing value, "Further explanation")
theAlert's beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(mainWindow, me, "alertDidEnd:returnCode:contextInfo:", missing value)
end showAlert_
on alertDidEnd_returnCode_contextInfo_(theAlert, returnCode, contextInfo)
log returnCode
end alertDidEnd_returnCode_contextInfo_
Any help would be GREATLY appreciated. Please let me know if there's anymore info I can provide.
Thanks so much!!!