home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- /*bdoc
- * Function "FIELD"
- *
- * Written: Dave Fritsche
- * Date: July, 1987
- *
- * This function will display an input field prompt (with attributes),
- * paint the initial input field (with attributes), accept input from
- * the keyboard according to the field template, reprint the input
- * field (with final attributes) upon input completion, reprint the prompt
- * field (with final attributes), and return the completion function code.
- * Syntax:
- * stat = field(tx, ty, tas, taf, title, ix, iy, ias,
- * iaf, ilinep, ilinet, ilined, rmask)
- * Where:
- * tx,ty -- Integer coordinates for beginning of field title
- * tas,taf -- Integer (S)tarting & (F)inishing attribute for title
- * title -- Title string
- * ix,iy -- Integer coordinates for beginning of input field
- * ias,iaf -- Integer (S)tarting & (F)inishing attribute for
- * input field
- * ilinep -- String containing initial input field (no data)
- * ilinet -- String containing input field template (see inputdb())
- * ilined -- String containing input string returned by "inputdb()"
- * rmask -- Char byte with functions enabled for legal return
- * 1 -- UP arrow
- * 2 -- DOWN arrow
- * 4 -- SHIFT-TAB
- * 8 -- TAB
- * 16 -- <CR>
- * 32 -- <ESC>
- * 64 -- "F1"
- * 128 -- "F2"
- * stat -- Integer function number that ended input
- edoc*/
-
- #include <stdio.h>
-
- int field(tx,ty,tas,taf,title,ix,iy,ias,iaf,ilinep,ilinet,ilined,rmask)
- int tx,ty,tas,taf,ix,iy,ias,iaf,rmask;
- char title[], ilinep[], ilinet[], ilined[];
- {
- int stat, n;
-
- stat = 0;
- puttxt(tx, ty, tas, 0, title);
- puttxt(ix, iy, ias, ias, ilinep);
- while ( (stat & rmask) == 0)
- {
- putcur(ix, iy);
- /*
- * stat = input(ilinet, ilined);
- */
- stat = inputdb(ilinet, ilined);
- if ( (stat & rmask) == 0)
- printf("%c", 7);
- }
- setatt(0); /* Clear attributes */
- if (taf != tas)
- puttxt(tx, ty, taf, 0, title);
- puttxt(ix, iy, iaf, iaf, ilinep);
- puttxt(ix, iy, iaf, 0, ilined);
- return(stat);
- }
-