home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
FNIFLD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-07
|
2KB
|
92 lines
/*
fnifld.c
% inter_field
This function is used by the standard field functions to facilitate
movement between fields.
Handling the interfield movement in one place save code space and
makes it easy to modify the interfield behavior. Simply replace
inter_field with a new function that performs as desired.
C-scape 3.2
Copyright (c) 1986, 1987, 1988 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
10/08/88 jmd Added TAB and SHFT_TAB
12/15/88 jmd ifdef'd out TAB and SHFT_TAB support
1/23/90 jmd added test for parent in ENTER case
3/28/90 jmd ansi-fied
8/07/90 pmcm changed BOB_DOWN to BOB_INC in ENTER case
*/
#include <stdio.h>
#include "cscape.h"
#include "scancode.h"
boolean inter_field(sed_type sed, int scancode)
/*
effects: Handles movement between fields.
ESC sets baton to 0, exits
ENTER goes to next field if possible
else if not a bob sets baton to fieldno, exits
else if a bob sets baton to BOB_INC
UP goes to the previous field,
DOWN goes to the next field,
* TAB goes to the right field
* SHFT_TAB goes to the left field
* Note: define the symbol TAB_SUPPORT to enable these keys
returns: TRUE if intercepted a key, FALSE otherwise.
*/
{
switch (scancode) {
case ESC:
sed_SetBaton(sed, 0);
sed_ToggleExit(sed);
return(TRUE);
case ENTER:
/* try to go to the next field else exit */
if (sed_IncField(sed) == SED_STUCK) {
if (bob_GetParent(sed) != NULL) {
/* we're embedded in another sed,
* return BOB_INC for bob_funcs' benefit
*/
sed_SetBaton(sed, BOB_INC);
}
else {
sed_SetBaton(sed, sed_GetFieldNo(sed)+1);
}
sed_ToggleExit(sed);
}
return(TRUE);
#ifdef TAB_SUPPORT
case TAB:
sed_RightField(sed);
return(TRUE);
case SHFT_TAB:
sed_LeftField(sed);
return(TRUE);
#endif
case UP:
sed_DecField(sed);
return(TRUE);
case DOWN:
sed_IncField(sed);
return(TRUE);
default:
break;
}
return(FALSE);
}