WxFrame

From WxWiki

Jump to: navigation, search

To 'minimize' a frame, use wxFrame::Iconize

See also: Wiki Guide: Using WxFrame, or Official docs: wxFrame

Contents

[edit] Issues

[edit] Why doesn't my wxFrame receive initial OnPaint events?

If your wxFrame doesn't receive the initial OnPaint event but receives all others, make sure that wxFrame::Show() is called after all children have been added to the frame. If you try to add a wxWindow to the frame after it has already been shown, weird things may happen.

[edit] Segmentation fault during my frame construction

It looks like you might recieve OnSize (and other) events before having leaved the frame constructor. That's why you must be particulary careful when managing these events. This issue is due to the fact that when you create a frame, windows makes it visible immediately even if wxWidgets is programmed to make it visible only after a call to wxWindow::Show.

[edit] Even if I don't call "Show" during OnInit, my frame is visible

It seems that Win32 will always show your frame even if you don't want it. Doing this will help you to get the required behaviour :

non-visible main frame at startup
bool MyApp::OnInit()
{
    MyFrame * mainFrame = new MyFrame(........);
    mainFrame->Show(true); // the wxFrame doesn't know that it is visible : we have to tell it !
    mainFrame->Show(false); // doing this, the frame will only be visible as a remanent image (only on slow computers)
    return true;
}

[edit] External links

Personal tools