Domanda

I've got a dialog in my application which is created using CreateStandardAlert/RunStandardAlert. Currently my 'OK' button is responding to the Return key, but Escape does nothing. Reading around the documentation it says that modal dialogs should respond to Escape, but this one isn't. Do I need to specify filterProc in the call to RunStandardAlert (currently I've set it to 0) or is the problem most likely somewhere else in my code?

È stato utile?

Soluzione

I assume your dialog doesn't have a Cancel button, which is what normally responds to Escape. I'm not sure if it is expected that an OK button should respond to Escape. You might be able to use SetDialogCancelItem if you could find the item number of the button.

Altri suggerimenti

It turns out I hadn't set one of my buttons as the cancel button. Basically I needed to put the following code to set it up:

alertParams.cancelText      = (CFStringRef) kAlertDefaultCancelText;
alertParams.cancelButton    = kAlertStdAlertCancelButton;

(this is after populating alertParams using GetStandardAlertDefaultParams)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top