wxMac: Modal dialog in main frame constructor

Derek Lee-Wo dleewo at gmail.com
Thu May 8 11:13:11 PDT 2008


This is an update explaining what I did to fix this.

It turns out that I was creating a wxTimer in the constructor. The
docs said I can either use a non-default constructor or extend wxTimer
and override the notify() method.  I did the first option, specifying
the main frame as the owner.  While this works OK in Windows and GTK,
it seems that wxMac didn't like it.

Once I went the other route by extending wxTimer and overriding the
notify() method I was able to pop a dialog from within the frame
constuctor.

Unfortunately I don't know "why" wxMac doesn't like it, but I'm just
happy that I managed to find and resolve my issue.

Derek


On Mon, May 5, 2008 at 7:02 AM, Derek Lee-Wo <dleewo at gmail.com> wrote:
> Hi,
>
>  > I think it should work, although for a splash screen wxApp::OnInit would
>  > probably be more suitable.
>
>  It's not actually a splash screen I'm trying to create.  It's for when
>  the app is run the first time, I pop up a dialog to gather a few
>  settings.
>
>  BTW, I also tried launching the dialog in wxApp::OnInit(), but I saw the
>  same problem.
>
>
>  > the message box pops up, then the message loop gets things wrong. I've
>  > seen
>  > this in code when code was ported from msw or gtk and was looking for
>  > some
>  > images, which it couldn't find in the mac build. So one typical source
>  > for
>
>  Well, I did actually see this issue with some wxIcons I was creating and
>  the Mac version couldn't find my PNG files.  I did see that error just
>  fine and once I copied over the files, that error went away.
>
>
>  > problems would be to debug OnPaint methods, or to put breakpoints in
>  > wxMessageDialog::ShowModal
>
>  Thanks for this suggestion.....I'll try these two approaches.
>
>  Thanks
>  Derek
>


More information about the wx-users mailing list