summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
30d6c59)
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
41 files changed:
// create the main application window
LifeFrame *frame = new LifeFrame();
// create the main application window
LifeFrame *frame = new LifeFrame();
- // show it and tell the application that it's our main window
// just for Motif
#ifdef __WXMOTIF__
// just for Motif
#ifdef __WXMOTIF__
@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
@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.
Note that the program's command line arguments, represented by @e argc and
@e argv, are available from within wxApp member functions.
Note that the program's command line arguments, represented by @e argc and
@e argv, are available from within wxApp member functions.
wxFrame *the_frame = new wxFrame(NULL, ID_MYFRAME, argv[0]);
...
the_frame->Show(true);
wxFrame *the_frame = new wxFrame(NULL, ID_MYFRAME, argv[0]);
...
the_frame->Show(true);
- SetTopWindow(the_frame);
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) );
frame->Show( true );
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) );
frame->Show( true );
62: frame = MyFrame(NULL, -1, "This is a test")
63: frame.Show(true)
64:
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
67:
68: # Return a success flag
69: return true
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
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
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
wxDEFAULT_FRAME_STYLE);
frame->Show(true);
wxDEFAULT_FRAME_STYLE);
frame->Show(true);
wxT("wxAUI Sample Application"),
wxDefaultPosition,
wxSize(800, 600));
wxT("wxAUI Sample Application"),
wxDefaultPosition,
wxSize(800, 600));
frame->Show();
return true;
frame->Show();
return true;
// create the main program window
MyFrame *frame = new MyFrame;
frame->Show(true);
// create the main program window
MyFrame *frame = new MyFrame;
frame->Show(true);
// use our config object...
if ( pConfig->Read(wxT("/Controls/Check"), 1l) != 0 ) {
// use our config object...
if ( pConfig->Read(wxT("/Controls/Check"), 1l) != 0 ) {
MyFrame *frame =
new MyFrame(NULL, "wxDataViewCtrl sample", 40, 40, 1000, 540);
MyFrame *frame =
new MyFrame(NULL, "wxDataViewCtrl sample", 40, 40, 1000, 540);
frame->Show(true);
return true;
frame->Show(true);
return true;
MyFrame *frame = new MyFrame(wxT("Dial-up wxWidgets demo"),
wxPoint(50, 50), wxSize(450, 340));
MyFrame *frame = new MyFrame(wxT("Dial-up wxWidgets demo"),
wxPoint(50, 50), wxSize(450, 340));
- // Show it and tell the application that it's our main window
// Init dial up manager
m_dial = wxDialUpManager::Create();
// Init dial up manager
m_dial = wxDialUpManager::Create();
frame->Centre();
frame->Show();
frame->Centre();
frame->Show();
MyFrame *frame = new MyFrame(wxT("Drawing sample"),
wxDefaultPosition, wxSize(550, 840));
MyFrame *frame = new MyFrame(wxT("Drawing sample"),
wxDefaultPosition, wxSize(550, 840));
- // Show it and tell the application that it's our main window
MyFrame *frame = new MyFrame(wxT("Exec wxWidgets sample"),
wxDefaultPosition, wxSize(500, 140));
MyFrame *frame = new MyFrame(wxT("Exec wxWidgets sample"),
wxDefaultPosition, wxSize(500, 140));
- // Show it and tell the application that it's our main window
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
MyFrame *frame = new MyFrame(wxT("Font wxWidgets demo"),
wxPoint(50, 50), wxSize(600, 400));
MyFrame *frame = new MyFrame(wxT("Font wxWidgets demo"),
wxPoint(50, 50), wxSize(600, 400));
- // Show it and tell the application that it's our main window
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned 'false' here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned 'false' here, the
#endif // !USE_SIMPLE_HELP_PROVIDER
frame->Show(true);
#endif // !USE_SIMPLE_HELP_PROVIDER
frame->Show(true);
// initialise the help system: this means that we'll use doc.hlp file under
// Windows and that the HTML docs are in the subdirectory doc for platforms
// initialise the help system: this means that we'll use doc.hlp file under
// Windows and that the HTML docs are in the subdirectory doc for platforms
MyFrame *frame = new MyFrame(_("HTML Help Sample"),
wxDefaultPosition, wxDefaultSize);
MyFrame *frame = new MyFrame(_("HTML Help Sample"),
wxDefaultPosition, wxDefaultSize);
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
MyFrame *frame = new MyFrame(_("Printing test"),
wxDefaultPosition, wxSize(640, 480));
MyFrame *frame = new MyFrame(_("Printing test"),
wxDefaultPosition, wxSize(640, 480));
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480));
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480));
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
wxFileSystem::AddHandler(new MyVFS);
// success: wxApp::OnRun() will be called which will enter the main message
wxFileSystem::AddHandler(new MyVFS);
// success: wxApp::OnRun() will be called which will enter the main message
MyFrame *frame = new MyFrame( _("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480) );
MyFrame *frame = new MyFrame( _("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480) );
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480) );
MyFrame *frame = new MyFrame(_("wxHtmlWindow testing application"),
wxDefaultPosition, wxSize(640, 480) );
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
frame->CenterOnScreen();
frame->Show(true);
frame->CenterOnScreen();
frame->Show(true);
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
frame->SetStatusText(wxT("Welcome to wxWidgets menu sample"));
#endif // wxUSE_STATUSBAR
frame->SetStatusText(wxT("Welcome to wxWidgets menu sample"));
#endif // wxUSE_STATUSBAR
frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, wxT("MyMainFrame"));
frame->Show(true);
frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, wxT("MyMainFrame"));
frame->Show(true);
- // Return the main frame window
- SetTopWindow(frame);
-
// Create the main window
MyFrame *frame = new MyFrame();
// Create the main window
MyFrame *frame = new MyFrame();
// Problem with generic wxNotebook implementation whereby it doesn't size
// properly unless you set the size again
// Problem with generic wxNotebook implementation whereby it doesn't size
// properly unless you set the size again
MyFrame *frame = new MyFrame(wxT("OleAuto wxWidgets App"),
wxPoint(50, 50), wxSize(450, 340));
MyFrame *frame = new MyFrame(wxT("OleAuto wxWidgets App"),
wxPoint(50, 50), wxSize(450, 340));
- // Show it and tell the application that it's our main window
- // @@@ what does it do exactly, in fact? is it necessary here?
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
return false;
// Create the main frame window
return false;
// Create the main frame window
- SetTopWindow(new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample")));
+ MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample"));
= new OwnerDrawnFrame(NULL, wxT("wxWidgets Ownerdraw Sample"),
50, 50, 450, 340);
= new OwnerDrawnFrame(NULL, wxT("wxWidgets Ownerdraw Sample"),
50, 50, 450, 340);
- SetTopWindow(pFrame);
-
frame->Centre(wxBOTH);
frame->Show();
frame->Centre(wxBOTH);
frame->Show();
RegFrame *frame = new RegFrame(NULL, wxT("wxRegTest"), 50, 50, 600, 350);
frame->Show(true);
RegFrame *frame = new RegFrame(NULL, wxT("wxRegTest"), 50, 50, 600, 350);
frame->Show(true);
return false;
wxFrame* frame = new MyFrame;
return false;
wxFrame* frame = new MyFrame;
frame->Show();
return true;
frame->Show();
return true;
// Create the main application window
MyFrame *frame = new MyFrame();
// Create the main application window
MyFrame *frame = new MyFrame();
- // Show it and tell the application that it's our main window
// Create the main application window
MyFrame *frame = new MyFrame();
// Create the main application window
MyFrame *frame = new MyFrame();
- // Show it and tell the application that it's our main window
// open application frame
m_frame->Layout ();
m_frame->Show (true);
// open application frame
m_frame->Layout ();
m_frame->Show (true);
- SetTopWindow (m_frame);
// report success
return true;
}
// report success
return true;
}
wxInitAllImageHandlers();
wxInitAllImageHandlers();
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
MyFrame *frame = new MyFrame((wxFrame *) NULL, wxT("Validator Test"),
50, 50, 300, 250);
frame->Show(true);
MyFrame *frame = new MyFrame((wxFrame *) NULL, wxT("Validator Test"),
50, 50, 300, 250);
frame->Show(true);