Opened 4 years ago

Closed 4 years ago

#16153 closed defect (fixed)

wxRichMessageDialog with only OK button returns wxID_CANCEL when you click OK.

Reported by: snowleopard2 Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: dev-latest
Keywords: wxRichMessageDialog Cc:
Blocked By: Blocking:
Patch: no


Create a wxRichMessageDialog with just an OK button (wxOK style), show it, click the OK button. Note that the return code from ShowModal will be wxID_CANCEL and not wxID_OK. Example code:

wxRichMessageDialog msg(wxTheApp->GetTopWindow(), wxT("hi"), wxT("hi"), wxOK|wxICON_INFORMATION);
const int dlgResponse = msg.ShowModal();//hitting OK will return wxID_CANCEL (5101)

Interestingly, if you add a Cancel button (add wxCANCEL to the style) and do the same thing then it returns the correct code. So it seems that just having one button causes the wrong code to be returned. This was working OK in earlier daily (2.9+) builds, seems to be new in the latest 3.1 builds.

I'm in Windows 8.1, but this appears to be a generic control, so it may happen elsewhere.

Change History (1)

comment:1 Changed 4 years ago by vadz

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by r76254 in 3.0 branch and r76257 in the trunk, thanks for reporting!

Note: See TracTickets for help on using tickets.