|
Static controls do not take any input and are used to display information or to enhance the application's aesthetics. wxGaugeThis is a horizontal or vertical bar that shows a quantity (often time) from zero to the specified range. No command events are generated for the gauge. Here's a simple example of creating a gauge: #include "wx/gauge.h" wxGauge* gauge = new wxGauge(panel, ID_GAUGE, 200, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL); gauge->SetValue(50); Under Windows, this is displayed as shown in Figure 4-28. Figure 4-28. A wxGaugewxGauge StylesTable 4-42 lists the specific window styles for wxGauge.
wxGauge EventsBecause it only displays information, wxGauge does not generate events. wxGauge Member FunctionsThese are the major wxGauge functions. GeTRange and SetRange are accessors for the gauge range (the maximum integer value). GetValue and SetValue get and set the integer value of the gauge. IsVertical returns TRue if the gauge is vertical, and false if horizontal. wxStaticTextA static text control displays one or more lines of read-only text. To create a wxStaticText control, pass a parent window, identifier, label, position, size, and style. For example: #include "wx/stattext.h" wxStaticText* staticText = new wxStaticText(panel, wxID_STATIC, wxT("This is my &static label"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); Under Windows, this creates the control shown in Figure 4-29. Figure 4-29. A wxStaticTextAn ampersand in the label (as shown here) indicates to some platformscurrently Windows and GTK+that the following letter should be underscored and used as a shortcut key for navigating to the next non-static control. wxStaticText StylesTable 4-43 lists the specific window styles for wxStaticText.
wxStaticText Member FunctionsGetLabel and SetLabel are accessors for the text label. wxStaticBitmapA static bitmap control displays an image. To create a wxStaticBitmap control, pass a parent window, identifier, bitmap, position, size and style. For example: #include "wx/statbmp.h" #include "print.xpm" wxBitmap bitmap(print_xpm); wxStaticBitmap* staticBitmap = new wxStaticBitmap(panel, wxID_STATIC, bitmap); This produces a simple image on the panel or dialog as shown in Figure 4-30. Figure 4-30. A wxStaticBitmapwxStaticBitmap StylesThere are no special styles for wxStaticBitmap. wxStaticBitmap Member FunctionsGetBitmap and SetBitmap are accessors for the bitmap label. wxStaticLineThis control displays a horizontal or vertical line, to be used as a separator in dialogs. Here's an example of creating a wxStaticLine control: #include "wx/statline.h" wxStaticLine* staticLine = new wxStaticLine(panel, wxID_STATIC, wxDefaultPosition, wxSize(150, -1), wxLI_HORIZONTAL); Figure 4-31 shows what a horizontal static line looks like under Windows. Figure 4-31. A wxStaticLinewxStaticLine StylesTable 4-44 lists the specific window styles for wxStaticLine.
wxStaticLine Member FunctionsIsVertical returns true if the line is vertical, false otherwise. wxStaticBoxThis control is a rectangle drawn around other controls to denote a logical grouping of items, with an optional text label. At present, the control should not be used as a parent for further controls; the controls that it surrounds are actually siblings of the box and should be created after it but with the same parent as the box. Future versions of wxWidgets may allow contained controls to be either siblings or children. Here's an example of creating a wxStaticBox control: #include "wx/statbox.h" wxStaticBox* staticBox = new wxStaticBox(panel, wxID_STATIC, wxT("&Static box"), wxDefaultPosition, wxSize(100, 100)); This will look like the control in Figure 4-32 under Windows. Figure 4-32. A wxStaticBoxwxStaticBox StylesThere are no special styles for wxStaticBox. wxStaticBox Member FunctionsUse GetLabel and SetLabel to get and set the static box text. |
|