Choosing Controls

Windows CE supplies a set of pre-constructed elements, known as controls, that you can use to build an application. Controls, objects that users interact with to enter or manipulate data, commonly appear in dialog boxes, can also appear on toolbars and command bars. Windows CE supports many pre-defined controls, which can be divided into two categories: windows controls and common controls. Windows controls typically send the WM_COMMAND message and include buttons, combo boxes, edit controls, list boxes, scroll bars, and static controls. Common controls typically send the WM_NOTIFY message and include all other controls. They are divided into the following sub-categories: Foundation controls, file controls, scale controls, informational controls, and miscellaneous controls that are used for specific Windows CE-based platform functionality.

Due to the large number of controls available in Windows CE, determining which control to use in a specified situation is often difficult. When choosing a control, you must consider the type of input you are trying to capture, the abilities and limitations of the control, and the characteristics of your platform's display screen. To assist you in this task, all pre-defined Windows CE controls and their uses are described in the following tables.

Windows CE Window Controls

Control Description Use
Check Box A two-part control consisting of a square box and text options. Each option acts as a switch that can be turned on — selected — or off — deselected. When an item is turned on, a check appears within the square box; otherwise, the square box is empty. Users can select more than one option. When setting properties, attributes, or values.
When more than one choice can be selected.
When ample screen space is available.
When options do not change.
Radio Button A two-part control consisting of a small circle and text options. When an option is selected, the circle appears highlighted or filled. Only one option can be selected at one time. When setting properties, attributes, or values.
When only one choice can be selected.
When ample screen space is available.
When options do not change.
Push Button (Command Button) A square or rectangle with a text or graphic label inside. When selected, an application immediately performs the associated action or command. To perform an action.
To display a menu or window.
To set a condition or property value.
When ample screen space is available.
Group Box A rectangular frame that surrounds a group of controls. To visually relate a group of related controls.
To visually relate elements within a control.
Combination Box A control possessing the characteristics of both an edit control and a list box or drop-down list box. Information may either be typed into the edit control field or selected from items displayed in the list box. When options are large in number and not frequently selected.
When the list of options may change.
When only one choice can be selected.
When screen space is limited; use with a drop-down list box combination only.
To capture unlisted data.
When users prefer to type information rather than select it from a list.
When a keyboard is present.
Edit Control A rectangular box in which information can be typed by the user or in which information is displayed for read-only purposes. Edit controls typically contain captions and can be designated as either single- or multiple-line. When options are difficult to categorize and vary in length.
When screen space is limited.
When a keyboard is present.
When providing a list of options is not feasible.
List Box A rectangular box containing a list of items from which either a single selection is made, or multiple selections are made. Lists can contain either text or graphics. If the list exceeds the boundaries of the box, scroll bars appear, enabling users to view the remaining items. When options are large in number and not frequently selected.
When screen space makes radio buttons or check boxes impractical.
When the list of options may change.
When ample screen space is available.
Drop-Down List Box A rectangular box with an arrow button on the side. When the arrow button is selected, the box displays a hidden list of items which seems to drop-down from a single item. If the list exceeds the boundaries of the box, scroll bars appear, enabling users to view the remaining list. When only one choice can be selected
When screen space is limited.
When options are large in number and not frequently selected.
Scroll Bar A rectangular container consisting of a scroll area, a slider box, and arrows. Scroll bars are typically found on primary and secondary windows. To view information that uses more than the allotted space.
Static Control A text field that displays read-only information. To display a caption.
To provide instructional information.
To display descriptive information.

Foundation controls, used to contain or manage other controls, are described in the following table.

Windows CE Foundation Controls

Control Description Use
Command Band A special kind of rebar control. It has a fixed band at the top containing a toolbar with a Close (X) button, and optionally, a Help (?) button and OK button, in the right corner. By default, each band in the command bands control contains a command bar. You can override this if you want a band to contain some other type of child window. To provide easy access to frequently used commands or options.
When screen space is limited.
Command Bar A toolbar that combines a menu bar as well as the Close (X) button, the Help (?) button, and the OK button. A command bar can contain menus, combo boxes, buttons, and separators. A separator is a blank space you can use to divide other elements into groups or to reserve space in a command bar. To provide easy access to frequently used commands or options.
When screen space is limited.
Toolbar A panel that contains a set of controls. To provide easy access to frequently used commands or options.
Property Sheet A control to define property sheets. It accepts dialog box layout specifications and automatically creates tabbed property pages. When creating property sheets.
Tab Control A tab control resembles a divider in a notebook and is used to define sections of information within the same window. To present repetitive, related information.
To present options or settings that can be applied to one object.
Rebar A control that acts as a container for a child window. It contains one or more bands; each band can contain one child window, which can be a toolbar or any other control. Each band can have its own bitmap, which is displayed as a background for the toolbar on that band. A user can resize or reposition a band by dragging its gripper bar. If a band has a text label next to its gripper bar, a user can maximize the band and restore it to its previous size. When screen space is limited.
To hide and show portions of a command bar.

File controls, used to display files, are described in the following table.

Windows CE File Controls

Control Description Use
Header Control A heading above a column of text or numbers that can be divided into two or more parts for multiple columns. Each part can operate like a command button to support a different function. To display text and graphics.
To aid the user in sorting or sizing columns of information.
Image List A special list box that contains a collection of images that are all the same size, such as bitmaps or icons. Image lists manage images, but do not display them. They are designed to be used with list view and tree view controls. To display a relationship between a set of containers.
When ample screen space is available.
When the displaying of icons or images is appropriate.
Tree View A special list box that displays a hierarchical set of labeled items as an indented outline. It includes buttons that allow the outline to be expanded and contracted. To display a relationship between a set of containers.
When ample screen space is available.
List View A special list box that displays a collection of files or folders consisting of an icon and a label. Selection and navigation in this control work similarly to that in a folder window. When the displaying of icons is appropriate.
When ample screen space is available.

Scale controls, used to increment scaled values, are described in the following table.

Windows CE Scale Controls

Control Description Use
Spin Box An edit control with an associated spin button control. A spin box allows the user to select an option by scrolling through a small list or by typing an item in the edit control field. When options are infrequently selected and small in number.
When screen space is limited.
To capture unlisted data.
When users prefer to type information rather than select it from a list.
When only one choice can be selected.
Trackbar (Slider) A bar with tick marks on it and a slider or thumb. The tick marks represent a range of values. When a user drags the slider arm, it moves in the appropriate direction, tick by tick. To set an attribute.
When only one choice can be selected.
When a limited range of possible settings exist.
When options are incremented.
When ample screen space is available.

Informational controls, used to provide information about tools, processes, or time, are described in the following table.

Windows CE Informational Controls

Control Description Use
Progress Bar A display-only control that consists of a rectangular bar that fills from left to right. To provide visual feedback concerning completion of a process.
When ample screen space is available.
Date and Time Picker A control that provides users with an easy a way to modify date and time information. Each field in the control displays a time element, such as month, day, hour, or minutes. To modify date and time information.
When screen space is limited.
Status Bar An area within a window, typically at the bottom, that displays information. It can contain display-only controls. To provide information about the current state of what is being viewed in the window.
To provide a descriptive message about a selected menu or toolbar.
Month Calendar Control A child window that displays a monthly calendar. The calendar can display one or more months at a time. To select date information.
When screen space is limited.
ToolTip Control A small pop-up window containing information about a control. A ToolTip appears when a pointer is moved over a control not possessing a label. To identify a control that has no caption.
To reduce screen clutter cause by control captions.

Miscellaneous controls, used for specific Windows CE-based platform functionality, are described in the following table.

Windows CE Miscellaneous Controls

Control Description Use
HTML Viewer Control A control that provides the functionality required to implement the Windows CE Pocket Internet Explorer and Help engine. To view HTML text and embedded images. For more information about the HTML viewer control, see Overview of Controls.
Rich Ink Control A control that captures stylus motions in order to emulate the act of writing or drawing on paper. The control's document view, under the touch-sensitive display screen, serves as electronic paper. In addition to capturing images, Active Ink also has editing and formatting capabilities. To accept user input without using a keyboard. For more information about the Rich Ink control, see User Input.

In addition to pre-defined controls, Windows CE supports a new custom draw service. The custom draw service is not a pre-defined control; it is a service that makes it easy to customize a common control's appearance. You can use the custom draw service to change a common control's color or font, or to partially or completely draw the control. This is useful when your interface uses several text boxes, because you can draw the borders of the text box before the user inserts text, then hide borders when displaying text. This enables you to place text closer together, making your interface appear less cluttered.

Besides using the controls included in Windows CE, you can also create your own custom controls. When designing custom controls, avoid the following pitfalls common to many designs: