home | |||
links |
|
||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 |
3 - Testing For KeysTo check for these and other keys, you could use a simple message loop such as the following:S32 CWindow1::MsgHandler(MSG_TYPE type,CViewable *from,S32 data) { if ( MSG_KEY==type ) { switch (data) { case K_JOG_UP: // process key... break; case K_JOG_DOWN: // process key... break; // and so forth for specific keys... default: // handle all other keys here break; } return 1; // handled - prevents beeping } return CWindow::MsgHandler(type,from,data); // default message handler }Note there are two ways to end processing of each key message. Returning 1 (true) tells the parent routine the message has been processed completely. Calling the default window message handler CWindow::MsgHandler() lets ordinary processing continue. For keys, this will often result in a beep, which may or may not be your preference. The column's sample program (both source and .SEB file) uses a message loop like this to display all key characters, as well as the special key values. With it, you can get a feel for the user interface options available. Previous Section Next Section |
||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |