home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
FUNCS
/
FNIFLDG.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
2KB
|
74 lines
/*
fnifldg.c
% inter_field_grid
This function is used by the gmenu field functions to facilitate
orthoganal movement between fields.
Handling the inter_field_grid movement in one place save code space and
makes it easy to modify the interfield behavior. Simply replace
inter_field_grid 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
3/28/90 jmd ansi-fied
*/
#include <stdio.h>
#include "cscape.h"
#include "scancode.h"
boolean inter_field_grid(sed_type sed, int scancode)
/*
effects: Handles movement between fields.
ESC sets baton to 0, exits
ENTER goes to next field if possible
else sets baton to fieldno, exits
UP goes up,
DOWN goes down,
LEFT goes left,
RIGHT goes right,
SHFT_TAB goes left,
TAB goes right,
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) {
sed_SetBaton(sed, sed_GetFieldNo(sed)+1);
sed_ToggleExit(sed);
}
return(TRUE);
case UP:
sed_UpField(sed);
return(TRUE);
case DOWN:
sed_DownField(sed);
return(TRUE);
case SHFT_TAB:
case LEFT:
sed_LeftField(sed);
return(TRUE);
case TAB:
case RIGHT:
sed_RightField(sed);
return(TRUE);
default:
break;
}
return(FALSE);
}