Install wxWidgets and DialogBlocks from the accompanying CD-ROM.
On Windows, you should install one or more of the compilers provided on the
CD-ROM if you do not already own a suitable compiler. After setting your
wxWidgets and compiler paths in the DialogBlocks Paths settings page, open
.Select a suitable configuration for your
compiler and platform such as MinGW Debug or VC++ Debug (Windows),GCC
Debug GTK+ (Linux), or GCC Debug Mac (Mac OS X), and press the green
Build and Run Project button.You may be prompted to build wxWidgets if you
have not already built it for the selected configuration.
You can also find a similar sample in
in your wxWidgets
distribution. If you do not wish to use DialogBlocks, you can simply compile
this sample instead. See Appendix A, “Installing wxWidgets,” for instructions
on how to build wxWidgets samples.
This is how the application starts running:
1. Depending on platform, the
or equivalent function runs
(supplied by wxWidgets, not the application). wxWidgets initializes its
internal data structures and creates an instance of
2. wxWidgets calls
,which creates an instance of
constructor creates the window via the
and adds an icon, menu bar,and status bar.
shows the frame and returns true.
5. wxWidgets starts the event loop, waiting for events and dispatching
them to the appropriate handlers.
As noted here, the application terminates when the frame is closed, when the
user either selects the Quit menu item or closes the frame via standard but-
tons or menus (these will differ from one platform to the next).
This chapter gave you an idea of how a really simple wxWidgets application
works. We’ve touched on the
class, event handling, application initial-
ization, and creating a menu bar and status bar. However complicated your
own code gets, the basic principles of starting the application will remain the
same, as we’ve shown in this small example. In the next chapter, we’ll take a
closer look at events and how your application handles them.