Remove calls to wxApp::SetTopWindow() from the samples and documentation.
It is definitely not necessary to call SetTopWindow() when there is only a single top level window and it is arguable whether it's useful to do it even when there are many of them so don't encourage its use in the documentation and also remove all its occurrences from the samples. Closes #12816. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,8 +27,7 @@ the wxApp::OnInit member defined for a class derived from wxApp.
|
||||
@e OnInit will usually create a top window as a bare minimum. Unlike in earlier
|
||||
versions of wxWidgets, OnInit does not return a frame. Instead it returns a
|
||||
boolean value which indicates whether processing should continue (@true) or not
|
||||
(@false). You call wxApp::SetTopWindow to let wxWidgets know about the top
|
||||
window.
|
||||
(@false).
|
||||
|
||||
Note that the program's command line arguments, represented by @e argc and
|
||||
@e argv, are available from within wxApp member functions.
|
||||
@@ -59,7 +58,6 @@ bool DerivedApp::OnInit()
|
||||
wxFrame *the_frame = new wxFrame(NULL, ID_MYFRAME, argv[0]);
|
||||
...
|
||||
the_frame->Show(true);
|
||||
SetTopWindow(the_frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -124,7 +124,6 @@ bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) );
|
||||
frame->Show( true );
|
||||
SetTopWindow( frame );
|
||||
return true;
|
||||
}
|
||||
@endcode
|
||||
|
@@ -206,8 +206,6 @@ python DialogUnits.py
|
||||
62: frame = MyFrame(NULL, -1, "This is a test")
|
||||
63: frame.Show(true)
|
||||
64:
|
||||
65: # Tell wxWidgets that this is our main window
|
||||
66: self.SetTopWindow(frame)
|
||||
67:
|
||||
68: # Return a success flag
|
||||
69: return true
|
||||
@@ -257,8 +255,7 @@ Destroy() method as shown on line 36.
|
||||
|
||||
Just like wxWidgets in C++, wxPython apps need to create a class derived from
|
||||
@c wxApp (line 56) that implements a method named @c OnInit, (line 59.) This
|
||||
method should create the application's main window (line 62) and use
|
||||
wxApp.SetTopWindow() (line 66) to inform wxWidgets about it.
|
||||
method should create the application's main window (line 62) and show it.
|
||||
|
||||
And finally, at line 72 an instance of the application class is created. At
|
||||
this point wxPython finishes initializing itself, and calls the @c OnInit
|
||||
|
Reference in New Issue
Block a user