Skip to content

Commit

Permalink
Improve wxApp::OnInit() documentation
Browse files Browse the repository at this point in the history
Mention OnInitCmdLine() and OnCmdLineParsed() and provide an example
illustrating calling the base class version.
  • Loading branch information
vadz committed Aug 21, 2024
1 parent a5d7372 commit 24729ce
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions interface/wx/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,24 @@ class wxAppConsole : public wxEvtHandler,
that the function returns @true.
Notice that if you want to use the command line processing provided by
wxWidgets you have to call the base class version in the derived class
OnInit().
wxWidgets (see OnInitCmdLine() and OnCmdLineParsed() functions) you
have to call the base class version in the derived class OnInit(),
e.g.:
@code
bool MyApp::OnInit() {
if ( !wxApp::OnInit() ) {
// The most likely reason for the error here is that incorrect
// command line arguments have been specified, so just exit:
// error message has already been given.
return false;
}
// Perform any additional initialization here.
return true;
}
@endcode
Return @true to continue processing, @false to exit the application
immediately.
Expand Down

0 comments on commit 24729ce

Please sign in to comment.