- // First, try the OK button, since it's closest in meaning.
- wxButton *btn = wxDynamicCast(FindWindow(wxID_OK), wxButton);
-
- // Next, try Cancel or Close buttons
- if (!btn)
- btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton);
- if (!btn)
- btn = wxDynamicCast(FindWindow(wxID_CLOSE), wxButton);
-
- if ( btn && btn->IsEnabled() )
- {
- // if we do have a cancel button, do press it
- btn->MSWCommand(BN_CLICKED, 0 /* unused */);
- processed = true;
- break;
- }
- else
- {
- // Finally, if there aren't appropriate buttons,
- // act as if it were the normal close button.