How to catch the pressed event button in NSAlert

Hi !!!
I try to catch the pressed event button in NSAlert. I use beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_ but i have error:

on alertFunction()
	set alert to NSAlert's alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_("text", "OK", "Chose", "Cancel", "text2")
	alert's setAlertStyle_(2)
	alert's setIcon_(NSImage's imageNamed_("Finder"))
	alert's beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(alert's mainWindow, me, "alertDidEnd_returnCode_contextInfo_", missing value)
	set theResponse to alert's runModal()
end alertFunction

on alertDidEnd_returnCode_contextInfo_(theAlert, returnCode, contextInfo)
	log sender
end alertDidEnd_returnCode_contextInfo_

So, what i have to write as first argument in beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_ ??

It should be a property that is an outlet for the window the sheet appears on, but even that is not going to make it work. There’s a known problem with the contextInfo argument, which takes a void* argument that throws ASObjC out.

The easiest solution is to use my Myriad Helpers, available here:

You’ll see a discussion of the problem there, too.

Thanks !!! It’s great and works well :).