Last changed 1995.02.11
The standard behaviour in Turbo Vision for moving from one field
to another within a dialog box is to use the TAB
. The
following code snippet shows how to modify this behaviour so that
you can instead use ENTER
or arrow keys to move to
another field.
// Override handleEvent for your dialog class with // the following: void TVDialog::handleEvent (TEvent &event) { if (event.what == evKeyDown) { switch (ctrlToArrow (event.keyDown.keyCode)) { case kbUp: { if (valid (cmCheck)) { selectNext (True); } clearEvent (event); break; } case kbEnter: { if (valid (cmCheck)) { selectNext (False); } clearEvent (event); break; } case kbTab: clearEvent (event); break; } } TDialog::handleEvent (event); return; }
NB There are a number of class extensions available which provide code along such lines.