Opened 10 years ago

Last modified 10 years ago

#4658 closed defect

wxDialog::ShowModal fails if dialog is already open

Reported by: hwiesmann Owned by: csomor
Priority: normal Milestone:
Component: old wxOSX/Carbon port Version:
Keywords: Cc: hwiesmann, csomor
Blocked By: Blocking:
Patch: no


The following code snippet does not work (taken from wxProgressDialog):

wxDialog dialog(....);


Unfortunately, this code fails but it is the recommended way to switch a dialog to a modal dialog because wxDialog::SetModal(bool) is marked as depreciated.

The reason is that inside wxDialog::ShowModal() wxDialog::Show(true) is called and that this one returns false if the dialog is already shown.




if (this->IsShown())




in wxDialog::ShowModal() should fix the problem.


Change History (2)

comment:1 Changed 10 years ago by vadz

Switching a modeless dialog to modal isn't supported. It probably should assert instead of silently doing nothing but in any case, if you need a modal dialog you really must call ShowModal() from the start.

comment:2 Changed 10 years ago by vadz

  • Cc vadz removed

I was wrong to close this bug as this behaviour must be supported as our own wxProgressDialog uses it (see #4664). I've applied the suggested patch now as part of r54328, thanks.

Note: See TracTickets for help on using tickets.