Contents Up Previous Next

wxWidgets samples

Probably the best way to learn wxWidgets is by reading the source of some 50+ samples provided with it. Many aspects of wxWidgets programming can be learnt from them, but sometimes it is not simple to just choose the right sample to look at. This overview aims at describing what each sample does/demonstrates to make it easier to find the relevant one if a simple grep through all sources didn't help. They also provide some notes about using the samples and what features of wxWidgets are they supposed to test.

There are currently more than 50 different samples as part of wxWidgets and this list is not complete. You should start your tour of wxWidgets with the minimal sample which is the wxWidgets version of "Hello, world!". It shows the basic structure of wxWidgets program and is the most commented sample of all - looking at its source code is recommended.

The next most useful sample is probably the controls one which shows many of wxWidgets standard controls, such as buttons, listboxes, checkboxes, comboboxes etc.

Other, more complicated controls, have their own samples. In this category you may find the following samples showing the corresponding controls:

wxCalendarCtrl Calendar a.k.a. date picker control
wxListCtrl List view control
wxTreeCtrl Tree view control
wxGrid Grid control

Finally, it might be helpful to do a search in the entire sample directory if you can't find the sample showing the control you are interested in by name. Most classes contained in wxWidgets occur in at least one of the samples.

Minimal sample
Art provider sample
Calendar sample
Checklist sample
Config sample
Controls sample
Database sample
DebugRpt sample
Dialogs sample
Dialup sample
DnD sample
Dynamic sample
Event sample
Except(ions) sample
Exec sample
Font sample
Grid sample
HTML samples
Image sample
Internat(ionalization) sample
Layout sample
Listctrl sample
Mediaplayer sample
Notebook sample
Render sample
Rotate sample
Scroll subwindow sample
Sockets sample
Sound sample
Statbar sample
Text sample
Thread sample
Toolbar sample
Treectrl sample
Wizard sample


Minimal sample

The minimal sample is what most people will know under the term Hello World, i.e. a minimal program that doesn't demonstrate anything apart from what is needed to write a program that will display a "hello" dialog. This is usually a good starting point for learning how to use wxWidgets.


Art provider sample

The artprov sample shows how you can customize the look of standard wxWidgets dialogs by replacing default bitmaps/icons with your own versions. It also shows how you can use wxArtProvider to get stock bitmaps for use in your application.


Calendar sample

This font shows the calendar control in action. It shows how to configure the control (see the different options in the calendar menu) and also how to process the notifications from it.


Checklist sample

This sample demonstrates use of the wxCheckListBox class intercepting check, select and double click events. It also tests use of various methods modifying the control, such as by deleting items from it or inserting new ones (these functions are actually implemented in the parent class wxListBox so the sample tests that class as well). The layout of the dialog is created using a wxBoxSizer demonstrating a simple dynamic layout.


Config sample

This sample demonstrates the wxConfig classes in a platform independent way, i.e. it uses text based files to store a given configuration under Unix and uses the Registry under Windows.

See wxConfig overview for the descriptions of all features of this class.


Controls sample

The controls sample is the main test program for most simple controls used in wxWidgets. The sample tests their basic functionality, events, placement, modification in terms of colour and font as well as the possibility to change the controls programmatically, such as adding an item to a list box etc. Apart from that, the sample uses a wxNotebook and tests most features of this special control (using bitmap in the tabs, using wxSizers and constraints within notebook pages, advancing pages programmatically and vetoing a page change by intercepting the wxNotebookEvent.

The various controls tested are listed here:

wxButton Push button control, displaying text
wxBitmapButton Push button control, displaying a bitmap
wxCheckBox Checkbox control
wxChoice Choice control (a combobox without the editable area)
wxComboBox A choice with an editable area
wxGauge A control to represent a varying quantity, such as time remaining
wxStaticBox A static, or group box for visually grouping related controls
wxListBox A list of strings for single or multiple selection
wxSpinCtrl A spin ctrl with a text field and a 'up-down' control
wxSpinButton A spin or 'up-down' control
wxStaticText One or more lines of non-editable text
wxStaticBitmap A control to display a bitmap
wxRadioBox A group of radio buttons
wxRadioButton A round button to be used with others in a mutually exclusive way
wxSlider A slider that can be dragged by the user


Database sample

The database sample is a small test program showing how to use the ODBC classes written by Remstar Intl. Obviously, this sample requires a database with ODBC support to be correctly installed on your system.


DebugRpt sample

This sample shows how to use wxDebugReport class to generate a debug report in case of a program crash or otherwise. On start up, it proposes to either crash itself (by dereferencing a NULL pointer) or generate debug report without doing it. Next it initializes the debug report with standard information adding a custom file to it (just a timestamp) and allows to view the information gal_coustar rootroot wxBoxSizer

Contents Up Previous Next

wxBoxSizer

The basic idea behind a box sizer is that windows will most often be laid out in rather simple basic geometry, typically in a row or a column or several hierarchies of either.

For more information, please see Programming with wxBoxSizer.

Derived from

wxSizer
wxObject

Include files

<wx/sizer.h>

See also

wxSizer, Sizer overview

wxBoxSizer::wxBoxSizer
wxBoxSizer::RecalcSizes
wxBoxSizer::CalcMin
wxBoxSizer::GetOrientation


wxBoxSizer::wxBoxSizer

wxBoxSizer(int orient)

Constructor for a wxBoxSizer. orient may be either of wxVERTICAL or wxHORIZONTAL for creating either a column sizer or a row sizer.


wxBoxSizer::RecalcSizes

void RecalcSizes()

Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling wxWindow::SetSize if the child is a window). It is used internally only and must not be called by the user. Documented for information.


wxBoxSizer::CalcMin

wxSize CalcMin()

Implements the calculation of a box sizer's minimal. It is used internally only and must not be called by the user. Documented for information.


wxBoxSizer::GetOrientation

int GetOrientation()

Returns the orientation of the box sizer, either wxVERTICAL or wxHORIZONTAL.

./usr/share/doc/wx2.6-doc/wx-manual.html/wx2.6-manual_samples.html0000644000000000000000000010636411254670525023466 0ustar rootroot wxWidgets samples

Contents Up Previous Next

wxWidgets samples

Probably the best way to learn wxWidgets is by reading the source of some 50+ samples provided with it. Many aspects of wxWidgets programming can be learnt from them, but sometimes it is not simple to just choose the right sample to look at. This overview aims at describing what each sample does/demonstrates to make it easier to find the relevant one if a simple grep through all sources didn't help. They also provide some notes about using the samples and what features of wxWidgets are they supposed to test.

There are currently more than 50 different samples as part of wxWidgets and this list is not complete. You should start your tour of wxWidgets with the minimal sample which is the wxWidgets version of "Hello, world!". It shows the basic structure of wxWidgets program and is the most commented sample of all - looking at its source code is recommended.

The next most useful sample is probably the controls one which shows many of wxWidgets standard controls, such as buttons, listboxes, checkboxes, comboboxes etc.

Other, more complicated controls, have their own samples. In this category you may find the following samples showing the corresponding controls:

wxCalendarCtrl Calendar a.k.a. date picker control
wxListCtrl List view control
wxTreeCtrl Tree view control
wxGrid Grid control

Finally, it might be helpful to do a search in the entire sample directory if you can't find the sample showing the control you are interested in by name. Most classes contained in wxWidgets occur in at least one of the samples.

Minimal sample
Art provider sample
Calendar sample
Checklist sample
Config sample
Controls sample
Database sample
DebugRpt sample
Dialogs sample
Dialup sample
DnD sample
Dynamic sample
Event sample
Except(ions) sample
Exec sample
Font sample
Grid sample
HTML samples
Image sample
Internat(ionalization) sample
Layout sample
Listctrl sample
Mediaplayer sample
Notebook sample
Render sample
Rotate sample
Scroll subwindow sample
Sockets sample
Sound sample
Statbar sample
Text sample
Thread sample
Toolbar sample
Treectrl sample
Wizard sample


Minimal sample

The minimal sample is what most people will know under the term Hello World, i.e. a minimal program that doesn't demonstrate anything apart from what is needed to write a program that will display a "hello" dialog. This is usually a good starting point for learning how to use wxWidgets.


Art provider sample

The artprov sample shows how you can customize the look of standard wxWidgets dialogs by replacing default bitmaps/icons with your own versions. It also shows how you can use wxArtProvider to get stock bitmaps for use in your application.


Calendar sample

This font shows the calendar control in action. It shows how to configure the control (see the different options in the calendar menu) and also how to process the notifications from it.


Checklist sample

This sample demonstrates use of the wxCheckListBox class intercepting check, select and double click events. It also tests use of various methods modifying the control, such as by deleting items from it or inserting new ones (these functions are actually implemented in the parent class wxListBox so the sample tests that class as well). The layout of the dialog is created using a wxBoxSizer demonstrating a simple dynamic layout.


Config sample

This sample demonstrates the wxConfig classes in a platform independent way, i.e. it uses text based files to store a given configuration under Unix and uses the Registry under Windows.

See wxConfig overview for the descriptions of all features of this class.


Controls sample

The controls sample is the main test program for most simple controls used in wxWidgets. The sample tests their basic functionality, events, placement, modification in terms of colour and font as well as the possibility to change the controls programmatically, such as adding an item to a list box etc. Apart from that, the sample uses a wxNotebook and tests most features of this special control (using bitmap in the tabs, using wxSizers and constraints within notebook pages, advancing pages programmatically and vetoing a page change by intercepting the wxNotebookEvent.

The various controls tested are listed here:

wxButton Push button control, displaying text
wxBitmapButton Push button control, displaying a bitmap
wxCheckBox Checkbox control
wxChoice Choice control (a combobox without the editable area)
wxComboBox A choice with an editable area
wxGauge A control to represent a varying quantity, such as time remaining
wxStaticBox A static, or group box for visually grouping related controls
wxListBox A list of strings for single or multiple selection
wxSpinCtrl A spin ctrl with a text field and a 'up-down' control
wxSpinButton A spin or 'up-down' control
wxStaticText One or more lines of non-editable text
wxStaticBitmap A control to display a bitmap
wxRadioBox A group of radio buttons
wxRadioButton A round button to be used with others in a mutually exclusive way
wxSlider A slider that can be dragged by the user


Database sample

The database sample is a small test program showing how to use the ODBC classes written by Remstar Intl. Obviously, this sample requires a database with ODBC support to be correctly installed on your system.


DebugRpt sample

This sample shows how to use wxDebugReport class to generate a debug report in case of a program crash or otherwise. On start up, it proposes to either crash itself (by dereferencing a NULL pointer) or generate debug report without doing it. Next it initializes the debug report with standard information adding a custom file to it (just a timestamp) and allows to view the information gal_coustar rootroot wxBoxSizer

Contents Up Previous Next

wxBoxSizer

The basic idea behind a box sizer is that windows will most often be laid out in rather simple basic geometry, typically in a row or a column or several hierarchies of either.

For more information, please see Programming with wxBoxSizer.

Derived from

wxSizer
wxObject

Include files

<wx/sizer.h>

See also

wxSizer, Sizer overview

wxBoxSizer::wxBoxSizer
wxBoxSizer::RecalcSizes
wxBoxSizer::CalcMin
wxBoxSizer::GetOrientation


wxBoxSizer::wxBoxSizer

wxBoxSizer(int orient)

Constructor for a wxBoxSizer. orient may be either of wxVERTICAL or wxHORIZONTAL for creating either a column sizer or a row sizer.


wxBoxSizer::RecalcSizes

void RecalcSizes()

Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling wxWindow::SetSize if the child is a window). It is used internally only and must not be called by the user. Documented for information.


wxBoxSizer::CalcMin

wxSize CalcMin()

Implements the calculation of a box sizer's minimal. It is used internally only and must not be called by the user. Documented for information.


wxBoxSizer::GetOrientation

int GetOrientation()

Returns the orientation of the box sizer, either wxVERTICAL or wxHORIZONTAL.

./usr/share/doc/wx2.6-doc/wx-manual.html/wx2.6-manual_samples.html0000644000000000000000000010636411254670525023466 0ustar rootroot wxWidgets samples

Contents Up Previous Next

wxWidgets samples

Probably the best way to learn wxWidgets is by reading the source of some 50+ samples provided with it. Many aspects of wxWidgets programming can be learnt from them, but sometimes it is not simple to just choose the right sample to look at. This overview aims at describing what each sample does/demonstrates to make it easier to find the relevant one if a simple grep through all sources didn't help. They also provide some notes about using the samples and what features of wxWidgets are they supposed to test.

There are currently more than 50 different samples as part of wxWidgets and this list is not complete. You should start your tour of wxWidgets with the minimal sample which is the wxWidgets version of "Hello, world!". It shows the basic structure of wxWidgets program and is the most commented sample of all - looking at its source code is recommended.

The next most useful sample is probably the controls one which shows many of wxWidgets standard controls, such as buttons, listboxes, checkboxes, comboboxes etc.

Other, more complicated controls, have their own samples. In this category you may find the following samples showing the corresponding controls:

wxCalendarCtrl Calendar a.k.a. date picker control
wxListCtrl List view control
wxTreeCtrl Tree view control
wxGrid Grid control

Finally, it might be helpful to do a search in the entire sample directory if you can't find the sample showing the control you are interested in by name. Most classes contained in wxWidgets occur in at least one of the samples.

Minimal sample
Art provider sample
Calendar sample
Checklist sampl