Partager via


Navigation Keys

4/19/2010

Windows Mobile has six navigation controls that allow a user to start applications, navigate lists, open records, and close fields and dialog boxes. The following table shows the default navigation controls.

Navigation control Description

Action key

Acts as the ENTER key

Program keys

Start applications

Up control

Acts as an UP ARROW key

Down control

Acts as a DOWN ARROW key

Left control

Acts as a LEFT ARROW key

Right control

Acts as a RIGHT ARROW key

Although every device for Windows Mobile implements these controls, the OEM decides on the number of controls and their placement. For example, it is possible to combine the direction keys and the Action key into a wheel that is similar in form to the wheel on the Microsoft IntelliMouse®. Pressing the wheel sends the VK_ENTER message, and spinning the wheel sends the VK_UP and VK_DOWN messages.

In most respects, programming a navigation control for a Windows Mobile device is identical to programming any other Windows–based input device; that is, your application captures messages and acts on them in the WndProc function. An OEM provides the driver that links each navigation control with WM_KEYUP and WM_KEYDOWN messages individually or in a series. Each message has a virtual key message in its wParam parameter. The driver starts when the user presses a navigation control. The driver then sends the window messagesto the device shell, which in turn passes the messages to the current application. See Message Map for Navigation Controls for a detailed itemization of a possible operation/message sequence.

The OEM also determines the original purpose of each program key. When pressed, a program key usually starts a predetermined application. However, there are some opportunities for application developers to modify or extend the behavior of certain program keys. For more detailed information, see Program Keys.

Windows Mobile Standard have a Back key that provides, depending on the current user interface, the default functions described in the following table.

User interface Back key functions

Window

Default to display the previous screen.

Message box or a dialog box without edit controls

Default to close the message box or dialog box.

Dialog box with edit controls

Override default to delete characters to the left of the cursor in an edit control.

For a dialog box with edit controls, it is recommended that you override the default behavior of the Back key and send it to the control with focus. This enables the user to modify data within the control, replicating the functionality of the Backspace key on a desktop keyboard.

Note

If a window is programmed to override the Back key, you can use the SHNavigateBack function to display the previous screen.

To override the Back key, you send the SHCMBM_OVERRIDEKEY message to the menu bar specified in the SHMENUBARINFO structure during the handling of the WM_INITDIALOG message. For an example of this operation, see How to Override the Back Key for Dialog Boxes with Edit Controls.

See Also

Tasks

How to Override the Back Key for Dialog Boxes with Edit Controls

Concepts

How to Handle the Back Key for Dialog Boxes Without Edit Controls

Other Resources

Mobile Device Hardware Overview