I have an NSAlert that I'm displaying with alert.runModal().
It displays until an NSTimer expires. I need to close this NSAlert and do some processing once the timer has expired.
In my timer's selector, I have tried:
alert.window().close()
alert.release()
NSApp.stopModal()
This closes the alert but causes the app to crash. Should I be stopping modal in a different way? Why is the app crashing?
My second try was to try to simulate NSButtonOK Click. Just using the button.performClick_() clicks the OK button but does nothing else. The alert does not close and no processing happens.
I am trying to use button.performKeyEquivalent_() but I'm not sure how to get set the NSEvent to the return key code, which is what the OK button responds to. Researching says I need to use a CGEvent and cast it to an NSEvent. Is this the only way? Will performKeyEquivalent even close the alert window and do my processing? Stuck and frustrated! Please help!
It displays until an NSTimer expires. I need to close this NSAlert and do some processing once the timer has expired.
In my timer's selector, I have tried:
alert.window().close()
alert.release()
NSApp.stopModal()
This closes the alert but causes the app to crash. Should I be stopping modal in a different way? Why is the app crashing?
My second try was to try to simulate NSButtonOK Click. Just using the button.performClick_() clicks the OK button but does nothing else. The alert does not close and no processing happens.
I am trying to use button.performKeyEquivalent_() but I'm not sure how to get set the NSEvent to the return key code, which is what the OK button responds to. Researching says I need to use a CGEvent and cast it to an NSEvent. Is this the only way? Will performKeyEquivalent even close the alert window and do my processing? Stuck and frustrated! Please help!