_DESIGNING PORTABLE USER INTERFACES_ by John L. Bradberry [LISTING ONE] /*+========================================================================= == Personal Phone Directory Utility == == author: john l. bradberry creation date: jan 30,1992 == == e-mail: jbrad@cc last modified: == ==========================================================================*/ #include #include #include #include #include #include #include #include #include #include #include "mstrlib.h" #include "doskbio.h" #include "filelib.h" #include "genlib.h" /*-------------------------- macros / constants --------------------------*/ #define MAXLABELS 50 /* maximum address records allowed*/ typedef enum {VOID, NAME, ADDRESS, PHONE} KEYTYPE; typedef enum {OFF, ON} ONOFF; typedef enum {FALSE, TRUE} BOOL; /*--------------------------- global variables ---------------------------*/ static char *MARKER = "[]" ;/* record seperator */ static char PHONEFILE[30] ;/* current data base file name */ /*------------------------------ structures ------------------------------*/ typedef struct { char Name[40] ;/* name of this person */ char Address[4][40] ;/* maximum of four address fields */ char PhoneNumber[40] ;/* phone number (parse later) */ char Greeting[20] ;/* as in Dear Mr/Ms: */ }PREC; struct { PREC Info[MAXLABELS] ;/* data base to be read in */ int Size ;/* number of records in phone list*/ char SearchString[40] ;/* string used in search */ int SearchKey ;/* search index into phone list */ } List; /*------------------------ function prototypes ---------------------------*/ BOOL ReadList(); BOOL SearchField(); BOOL NextLine(); void DispRecord(); void DispLine(); /*----------------------- WINDOW RELATED CONTROL -------------------------*/ #include "dosmenu.h" /*+========================================================================= ==program main: Phone Directory Utility... == ==========================================================================*/ int main() { int Ival ;/* temporary variable */ BOOL NoExit ;/* indicates end of menu mode */ char Stemp[80] ;/* temporary string */ char NameSearch[40] ;/* string used in name search */ char AddressSearch[40] ;/* string used in address search */ char PhoneSearch[40] ;/* string used in phone search */ KEYTYPE LastType ;/* last type of search performed */ List.SearchKey = 0; strcpy(PHONEFILE,"genlist.dat"); List.SearchString[0]='\0'; NameSearch[0]='\0'; AddressSearch[0]='\0'; PhoneSearch[0]='\0'; /*++++ Display main menu mask... ++++*/ ClearMain(); /*++++ Sub menu control loop... ++++*/ NoExit=TRUE; if (ReadList(PHONEFILE) == FALSE) errout("Data Base File Read Error!"); DispLine(PHONEFILE, 5, 39, 28, VFBRWHITE, VFBLUE<<4); if (List.Size > 0) DispRecord(); Midx=0; while (NoExit) { Midx=box_select(PhoneMain,VFBRWHITE,VFCYAN,LBUTTON,MenuLines, Marker,VFBLUE); switch (Midx) { case 0: List.SearchKey = 0; get_sval("Enter Database File Name: ",PHONEFILE); strim(PHONEFILE); DispLine(PHONEFILE, 5, 39, 28, VFBRWHITE, VFBLUE<<4); if (ReadList(PHONEFILE) == FALSE) errout("Data Base File Read Error!"); else DispRecord(); break; case 1: if (List.Size > 0) { List.SearchKey = (List.SearchKey < List.Size - 1 ? List.SearchKey + 1 : 0); DispRecord(); } else errout("No Valid Data Base!"); break; case 2: if (List.Size > 0) { List.SearchKey = (List.SearchKey > 0 ? List.SearchKey - 1 : List.Size - 1); DispRecord(); } else errout("No Valid Data Base!"); break; case 3: if (List.Size > 0) { List.SearchKey = 0; get_sval("Enter Name Search Chars: ",NameSearch); strcpy(List.SearchString,NameSearch); LastType = NAME; SearchField(LastType, List.SearchString); DispLine(NameSearch, 8, 39, 28, VFBRWHITE, VFBLUE<<4); DispLine(List.SearchString, 11, 39, 28, VFBRWHITE, VFBLUE<<4); DispRecord(); } else errout("No Valid Data Base!"); break; case 4: if (List.Size > 0) { List.SearchKey = 0; get_sval("Enter Phone Search Chars: ",PhoneSearch); strcpy(List.SearchString,PhoneSearch); LastType = PHONE; SearchField(LastType, List.SearchString); DispLine(PhoneSearch, 9, 39, 28, VFBRWHITE, VFBLUE<<4); DispLine(List.SearchString, 11, 39, 28, VFBRWHITE, VFBLUE<<4); DispRecord(); } else errout("No Valid Data Base!"); break; case 5: if (List.Size > 0) { List.SearchKey = 0; get_sval("Enter Address Search Chars: ",AddressSearch); strcpy(List.SearchString,AddressSearch); LastType = ADDRESS; SearchField(LastType, List.SearchString); DispLine(AddressSearch, 10, 39, 28, VFBRWHITE, VFBLUE<<4); DispLine(List.SearchString, 11, 39, 28, VFBRWHITE, VFBLUE<<4); DispRecord(); } else errout("No Valid Data Base!"); break; case 6: if (List.Size > 0) { SearchField(LastType, List.SearchString); DispRecord(); } else errout("No Valid Data Base!"); break; case 7: Ival=question("Exit this program to DOS: Y(es)"); if ((Ival=='y')||(Ival=='Y')||(Ival=='\r')) { NoExit = FALSE; } break; default: cur_posit(MenuRow,MenuCol); box_menu_start("Directory Utility",PhoneMain,VFBRWHITE, VFCYAN,VFBRWHITE,DOUBLEBAR,MenuLines,VFBLUE); break; } } /*+++++ Exit and restore CRT to main video page... +++++*/ setvpage(0); clear(); cur_posit(21,0); }/* end of main */ /*+========================================================================= ==BOOL ReadList: Open user phone data base and read into structure... == ==========================================================================*/ BOOL ReadList(Dbase) char *Dbase; { BOOL Stcode ;/* status code returned */ char Stemp[80] ;/* temporary string */ BOOL NewRecord ;/* indicates beginning new field */ FILE *FileHandle ;/* pointer to pipe file */ List.Size = -1; Stcode = FALSE; NewRecord = FALSE; FileHandle=fopen(Dbase,"rb"); if (FileHandle != NULL) { while ((NextLine(Stemp, FileHandle)) && (List.Size < MAXLABELS -1)) { if (spos(Stemp, MARKER) > 0) { List.Size++; if ((NextLine(List.Info[List.Size].Name, FileHandle)) && (List.Size < MAXLABELS -1)) { NextLine(List.Info[List.Size].Address[0], FileHandle); NextLine(List.Info[List.Size].Address[1], FileHandle); NextLine(List.Info[List.Size].Address[2], FileHandle); NextLine(List.Info[List.Size].Address[3], FileHandle); NextLine(List.Info[List.Size].PhoneNumber, FileHandle); NextLine(List.Info[List.Size].Greeting, FileHandle); } } } } if (List.Size > 0) Stcode = TRUE; return(Stcode); }/* end of ReadList */ /*+========================================================================= ==BOOL NextLine: Read next line in file... == ==========================================================================*/ BOOL NextLine(String, FileHandle) char *String; FILE *FileHandle; { BOOL Stcode ;/* status code returned */ char Stemp[80] ;/* temporary string */ char *Sptr ;/* pointer to string */ Stcode = FALSE; String[0] = '\0'; if (fgets(Stemp, sizeof Stemp, FileHandle) != NULL) { Sptr = strrchr(Stemp,'\r'); if (Sptr != NULL) *Sptr = ' '; Sptr = strrchr(Stemp,'\n'); if (Sptr != NULL) *Sptr = ' '; strim(Stemp); strcpy(String,Stemp); Stcode = TRUE; } return(Stcode); }/* end of NextLine */ /*+========================================================================= ==BOOL SearchField: Search phone for data using key to select field.. == ==========================================================================*/ BOOL SearchField(Key, Sdata) KEYTYPE Key; char *Sdata; { BOOL Stcode ;/* status code returned */ int OldSearchKey ;/* copy of search key returned */ BOOL NoMatch ;/* indicates search data found */ Stcode = FALSE; NoMatch = TRUE; OldSearchKey = List.SearchKey; if (List.SearchKey != 0) List.SearchKey++; while((NoMatch) && (List.SearchKey < List.Size)) { switch (Key) { case NAME: if (spos(List.Info[List.SearchKey].Name , Sdata) > 0) NoMatch = FALSE; break; case PHONE: if (spos(List.Info[List.SearchKey].PhoneNumber , Sdata) > 0) NoMatch = FALSE; break; case ADDRESS: if (spos(List.Info[List.SearchKey].Address[0] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[1] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[2] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[3] , Sdata) > 0) NoMatch = FALSE; break; default: puts("Error - bad key"); } if (NoMatch) List.SearchKey++; else Stcode = TRUE; } if (NoMatch) List.SearchKey = OldSearchKey; return(Stcode); }/* end of SearchField */ /*+========================================================================= ==void DispRecord: Display record on video box of main menu... == ==========================================================================*/ void DispRecord() { char Stemp[80] ;/* temporary string */ sprintf(Stemp,"[%3d] ",List.SearchKey); sjoin(Stemp,List.Info[List.SearchKey].Name); DispLine(Stemp, TableRow+1, TableCol+2, 37, VFBRWHITE, VFMAGENTA<<4); DispLine(List.Info[List.SearchKey].Address[0], TableRow+2, TableCol+8, 32, VFBRWHITE, VFMAGENTA<<4); DispLine(List.Info[List.SearchKey].Address[1], TableRow+3, TableCol+8, 32, VFBRWHITE, VFMAGENTA<<4); DispLine(List.Info[List.SearchKey].Address[2], TableRow+4, TableCol+8, 32, VFBRWHITE, VFMAGENTA<<4); DispLine(List.Info[List.SearchKey].Address[3], TableRow+5, TableCol+8, 32, VFBRWHITE, VFMAGENTA<<4); DispLine(List.Info[List.SearchKey].PhoneNumber, TableRow+6, TableCol+8, 32, VFBRWHITE, VFMAGENTA<<4); }/* end of DispRecord */ /*+========================================================================= ==void DispLine: Display single line on video of main menu... == ==========================================================================*/ void DispLine(String, Row, Col, Width, ForColor, BackColor) char *String; int Row; int Col; int Width; int ForColor; int BackColor; { char Stemp[80] ;/* temporary string */ char Bline[80] ;/* blank line */ memset(Bline,' ',Width + 1); Bline[Width + 1]='\0'; cputmemstr(Bline,Row,Col,ForColor,BackColor); strcpy(Stemp,String); Stemp[Width + 1]='\0'; cputmemstr(Stemp,Row,Col,ForColor,BackColor); }/* end of DispLine */ [LISTING TWO] /*+========================================================================= == Personal Phone Directory Utility == == author: john l. bradberry creation date: jan 30,1992 == == e-mail: jbrad@cc last modified: == ==========================================================================*/ #include /*-------------------------- macros / constants --------------------------*/ /*----------------------- WINDOW RELATED CONTROL -------------------------*/ /*--------------------------- window globals -----------------------------*/ static int TableRow = 14 ;/* table display row position */ static int TableCol = 15 ;/* table display row position */ static int MenuRow = 4 ;/* menu display row position */ static int MenuCol = 10 ;/* menu display column position */ static int Marker = 15 ;/* menu indicator token */ static int Midx ;/* index counter into menu table */ static int MenuLines = 8 ;/* number of lines in menu */ /*------------------------- window structures ----------------------------*/ static DEFINEMENU PhoneMain[] = { MENUITEM("c) Change Data Base : ", "Change name of data base file.", 'c') MENUITEM("f) Foward (Next Record) : ", "Display all fields in next record index.", 'f') MENUITEM("b) Backward (Prev Record): ", "Display all fields in previous record index.", 'b') MENUITEM("n) Name Search :", "Search name fields in all records for match.", 'n') MENUITEM("p) Phone Search :", "Search phone number fields in all records for match.", 'p') MENUITEM("a) Address Search :", "Search address fields in all records for match.", 'a') MENUITEM("r) Repeat Last Search :", "Repeat last search attempted and find next matching key.", 'r') MENUITEM("x) Return to DOS :", "Exit program and return to DOS operating system.", 'x') MENUITEMEND }; static DEFINETABLE PhoneTable[] = { TABLEITEM(" ") TABLEITEM(" ") TABLEITEM(" ") TABLEITEM(" ") TABLEITEM(" ") TABLEITEM(" ") TABLEITEMEND }; /*------------------------ function prototypes ---------------------------*/ void ClearMain(); /*+========================================================================= ==void ClearMain: Clear screen and display main menu... == ==========================================================================*/ void ClearMain(void) { int Row; /* row position */ int Col; /* column position */ /*++++ Set menu related global variables... ++++*/ BLINKOFF(atbyte); pagenum=PAGE0; setvpage(pagenum); colclear(VBCYAN); boxtype=1; shadow=0; Row=23; Col=0; cur_posit(Row,Col); /* standard prompt position */ coleraselin(Row-1,VBBLUE); coleraselin(Row,VBBLUE); coleraselin(Row+1,VBBLUE); cur_posit(1,0); coceprt("PHONEMATE - Telephone Directory Utility (Ver 3.1)", VFBRWHITE,VBBLUE); cur_posit(TableRow,TableCol); table_display(" ", PhoneTable,VFLICYAN,VFMAGENTA,VFYELLOW,DOUBLEBAR); mensel = MenuLines-1; cur_posit(MenuRow,MenuCol); box_menu_start("Directory Utility",PhoneMain,VFBRWHITE, VFCYAN,VFBRWHITE,DOUBLEBAR,MenuLines,VFBLUE); }/* end of ClearMain */ [LISTING THREE] /*+========================================================================= == Personal Phone Directory Utility == == author: john l. bradberry creation date: jan 30,1992 == == e-mail: jbrad@cc last modified: == ==========================================================================*/ #include #include #include #include #include #include #include #include #include "syshead.h" /*-------------------------- macros / constants --------------------------*/ #define MAXLABELS 50 /* maximum address records allowed*/ typedef enum {VOID, NAME, ADDRESS, PHONE} KEYTYPE; typedef enum {OFF, ON} ONOFF; typedef enum {FALSE, TRUE} BOOL; /*--------------------------- global variables ---------------------------*/ static char *MARKER = "[]" ;/* record seperator */ static char PHONEFILE[80] ;/* current data base file name */ static KEYTYPE LastType ;/* last type of search performed */ static char NameSearch[80] ;/* string used in name search */ static char AddressSearch[80] ;/* string used in address search */ static char PhoneSearch[80] ;/* string used in phone search */ /*------------------------------ structures ------------------------------*/ typedef struct { char Name[80] ;/* name of this person */ char Address[4][80] ;/* maximum of four address fields */ char PhoneNumber[80] ;/* phone number (parse later) */ char Greeting[80] ;/* as in Dear Mr/Ms: */ }PREC; struct { PREC Info[MAXLABELS] ;/* data base to be read in */ int Size ;/* number of records in phone list */ char SearchString[80] ;/* string used in search */ int SearchKey ;/* search index into phone list */ } List; /*------------------------ function prototypes ---------------------------*/ BOOL ReadList(); BOOL SearchField(); BOOL NextLine(); void DispRecord(); void DispLine(); /*----------------------- WINDOW RELATED CONTROL -------------------------*/ static int LineRow = 200 ;/* table display row position */ static int LineCol = 80 ;/* table display col position */ Frame PhoneFrame ;/* base frame for phone menu */ Panel PhonePanel ;/* base panel for phone menu */ Menu PhoneMenu ;/* base menu for phone menu */ Panel_item PhoneFile ;/* Phone data base file - handle.*/ Panel_item PhoneNameSearch ;/* Phone name search - handle.*/ Panel_item PhoneNumberSearch ;/* Phone number search - handle.*/ Panel_item PhoneAddressSearch ;/* Phone address search - handle.*/ Panel_item PhoneChoice ;/* Phone search options - handle.*/ /*------------------------ function prototypes ---------------------------*/ void PhoneQuit(); int PhoneSelect(); int ChoiceSelect(); int PhoneForward(); int PhoneBackward(); int RepeatSearch(); /*+========================================================================= == program main: Phone Directory Utility... == ==========================================================================*/ int main() { List.SearchKey = 0; strcpy(PHONEFILE,"genlist.dat"); List.SearchString[0]='\0'; NameSearch[0]='\0'; AddressSearch[0]='\0'; PhoneSearch[0]='\0'; /*+++++ Display main menu mask...++++*/ PhoneFrame = (Frame)xv_create(NULL, FRAME, FRAME_NO_CONFIRM, TRUE, FRAME_INHERIT_COLORS, TRUE, FRAME_LABEL, "PHONEMATE - Telephone Directory Utility (Ver 3.1)", NULL); PhonePanel = (Panel) xv_create(PhoneFrame, PANEL, NULL); PhoneFile = xv_create(PhonePanel, PANEL_TEXT, PANEL_NEXT_ROW, -1, PANEL_LABEL_STRING, "Change Data Base", PANEL_VALUE, PHONEFILE, PANEL_VALUE_DISPLAY_LENGTH, 50, PANEL_VALUE_X, 150, PANEL_NOTIFY_PROC, PhoneSelect, NULL); PhoneNameSearch = xv_create(PhonePanel, PANEL_TEXT, PANEL_NEXT_ROW, -1, PANEL_LABEL_STRING, "Name Search", PANEL_VALUE, NameSearch, PANEL_VALUE_DISPLAY_LENGTH, 50, PANEL_VALUE_X, 150, PANEL_NOTIFY_PROC, PhoneSelect, NULL); PhoneNumberSearch = xv_create(PhonePanel, PANEL_TEXT,PANEL_NEXT_ROW, -1, PANEL_LABEL_STRING, "Number Search", PANEL_VALUE, PhoneSearch, PANEL_VALUE_DISPLAY_LENGTH, 50, PANEL_VALUE_X, 150, PANEL_NOTIFY_PROC, PhoneSelect, NULL); PhoneAddressSearch = xv_create(PhonePanel, PANEL_TEXT, PANEL_NEXT_ROW, -1, PANEL_LABEL_STRING, "Address Search", PANEL_VALUE, AddressSearch, PANEL_VALUE_DISPLAY_LENGTH, 50, PANEL_VALUE_X, 150, PANEL_NOTIFY_PROC, PhoneSelect, NULL); PhoneChoice = xv_create(PhonePanel, PANEL_CHOICE, PANEL_LABEL_STRING, "Search Options", PANEL_NEXT_ROW, 40, PANEL_CHOICE_STRINGS,"Repeat Last Search", "Next Record", "Previous Record", NULL, PANEL_NOTIFY_PROC, ChoiceSelect, NULL); (void) xv_create(PhonePanel, PANEL_BUTTON, PANEL_LABEL_STRING, "Exit Phone Menu System", XV_X, 225, XV_Y, 450, PANEL_NOTIFY_PROC, PhoneQuit, NULL); if (ReadList(PHONEFILE) == FALSE) errout("Data Base File Read Error!"); if (List.Size > 0) DispRecord(); /*++++ Sub menu control loop...++++*/ window_fit(PhoneFrame); xv_main_loop(PhoneFrame); /*++++ Exit and restore CRT to main video page...++++*/ }/* end of main */ /*+========================================================================= == int PhoneSelect: Process event from phone menu selection... == ==========================================================================*/ int PhoneSelect(item, event) Panel_item item; Event *event; { char ItemName[82] ;/* name of item event */ strcpy(ItemName , (char *)xv_get(item, PANEL_LABEL_STRING)); if (spos(ItemName, "Data Base") > 0) { strcpy(PHONEFILE , (char *)xv_get(item, PANEL_VALUE)); strim(PHONEFILE); if (ReadList(PHONEFILE) == FALSE) errout("Data Base File Read Error!"); else DispRecord(); } else if (spos(ItemName, "Name") > 0) { strcpy(NameSearch , (char *)xv_get(item, PANEL_VALUE)); if (List.Size > 0) { List.SearchKey = 0; strcpy(List.SearchString,NameSearch); LastType = NAME; SearchField(LastType, List.SearchString); DispRecord(); } else errout("No Valid Data Base!"); } else if (spos(ItemName, "Number") > 0) { strcpy(PhoneSearch , (char *)xv_get(item, PANEL_VALUE)); if (List.Size > 0) { List.SearchKey = 0; strcpy(List.SearchString,PhoneSearch); LastType = PHONE; SearchField(LastType, List.SearchString); DispRecord(); } else errout("No Valid Data Base!"); } else if (spos(ItemName, "Address") > 0) { strcpy(AddressSearch , (char *)xv_get(item, PANEL_VALUE)); if (List.Size > 0) { List.SearchKey = 0; strcpy(List.SearchString,AddressSearch); LastType = ADDRESS; SearchField(LastType, List.SearchString); DispRecord(); } else errout("No Valid Data Base!"); } return XV_OK; }/* end of PhoneSelect */ /*+========================================================================= ==int ChoiceSelect: Call search option function... == ==========================================================================*/ int ChoiceSelect(item, event) Panel_item item; Event *event; { int ChoiceVal ;/* value of keypress */ ChoiceVal = (int )xv_get(item, PANEL_VALUE); if (List.Size > 0) { switch (ChoiceVal) { case 0: SearchField(LastType, List.SearchString); break; case 1: List.SearchKey = (List.SearchKey < List.Size - 1 ? List.SearchKey + 1 : 0); break; case 2: List.SearchKey = (List.SearchKey > 0 ? List.SearchKey - 1 : List.Size - 1); break; } DispRecord(); } else errout("No Valid Data Base!"); return XV_OK; }/* end of ChoiceSelect */ /*+========================================================================= ==void PhoneQuit: Destroy frame and exit menu... == ==========================================================================*/ void PhoneQuit() { xv_destroy_safe(PhoneFrame); }/* end of PhoneQuit */ /*+========================================================================= ==BOOL ReadList: Open user phone data base and read into structure... == ==========================================================================*/ BOOL ReadList(Dbase) char *Dbase; { BOOL Stcode ;/* status code returned */ char Stemp[80] ;/* temporary string */ BOOL NewRecord ;/* indicates beginning new field */ FILE *FileHandle ;/* pointer to pipe file */ List.Size = -1; Stcode = FALSE; NewRecord = FALSE; FileHandle=fopen(Dbase,"rb"); if (FileHandle != NULL) { while ((NextLine(Stemp, FileHandle)) && (List.Size < MAXLABELS -1)) { if (spos(Stemp, MARKER) > 0) { List.Size++; if ((NextLine(List.Info[List.Size].Name,FileHandle)) && (List.Size < MAXLABELS -1)) { NextLine(List.Info[List.Size].Address[0], FileHandle); NextLine(List.Info[List.Size].Address[1], FileHandle); NextLine(List.Info[List.Size].Address[2], FileHandle); NextLine(List.Info[List.Size].Address[3], FileHandle); NextLine(List.Info[List.Size].PhoneNumber, FileHandle); NextLine(List.Info[List.Size].Greeting, FileHandle); } } } } if (List.Size > 0) Stcode = TRUE; return(Stcode); }/* end of ReadList */ /*+========================================================================= ==BOOL NextLine: Read next line in file... == ==========================================================================*/ BOOL NextLine(String, FileHandle) char *String; FILE *FileHandle; { BOOL Stcode ;/* status code returned */ char Stemp[80] ;/* temporary string */ char *Sptr ;/* pointer to string */ Stcode = FALSE; String[0] = '\0'; if (fgets(Stemp, sizeof Stemp, FileHandle) != NULL) { Sptr = strrchr(Stemp,'\r'); if (Sptr != NULL) *Sptr = ' '; Sptr = strrchr(Stemp,'\n'); if (Sptr != NULL) *Sptr = ' '; strim(Stemp); strcpy(String,Stemp); Stcode = TRUE; } return(Stcode); }/* end of NextLine */ /*+========================================================================= ==BOOL SearchField: Search phone for data using key to select field.. == ==========================================================================*/ BOOL SearchField(Key, Sdata) KEYTYPE Key; char *Sdata; { BOOL Stcode ;/* status code returned */ int OldSearchKey ;/* copy of search key returned */ BOOL NoMatch ;/* indicates search data found */ Stcode = FALSE; NoMatch = TRUE; OldSearchKey = List.SearchKey; if (List.SearchKey != 0) List.SearchKey++; while((NoMatch) && (List.SearchKey < List.Size)) { switch (Key) { case NAME: if (spos(List.Info[List.SearchKey].Name , Sdata) > 0) NoMatch = FALSE; break; case PHONE: if (spos(List.Info[List.SearchKey].PhoneNumber , Sdata) > 0) NoMatch = FALSE; break; case ADDRESS: if (spos(List.Info[List.SearchKey].Address[0] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[1] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[2] , Sdata) > 0) NoMatch = FALSE; if (spos(List.Info[List.SearchKey].Address[3] , Sdata) > 0) NoMatch = FALSE; break; default: puts("Error - bad key"); } if (NoMatch) List.SearchKey++; else Stcode = TRUE; } if (NoMatch) List.SearchKey = OldSearchKey; return(Stcode); }/* end of SearchField */ /*+========================================================================= ==void DispRecord: Display record on video box of main menu... == ==========================================================================*/ void DispRecord() { char Stemp[80] ;/* temporary string */ DispLine(" ", LineRow+20, 10); DispLine(" ", LineRow+40, LineCol); DispLine(" ", LineRow+60, LineCol); DispLine(" ", LineRow+80, LineCol); DispLine(" ", LineRow+100, LineCol); DispLine(" ", LineRow+120, LineCol); sprintf(Stemp,"[%3d]",List.SearchKey); DispLine(Stemp, LineRow+20, 10); DispLine(List.Info[List.SearchKey].Name, LineRow+20, LineCol); DispLine(List.Info[List.SearchKey].Address[0], LineRow+40, LineCol); DispLine(List.Info[List.SearchKey].Address[1], LineRow+60, LineCol); DispLine(List.Info[List.SearchKey].Address[2], LineRow+80, LineCol); DispLine(List.Info[List.SearchKey].Address[3], LineRow+100, LineCol); DispLine(List.Info[List.SearchKey].PhoneNumber, LineRow+120, LineCol); }/* end of DispRecord */ /*+========================================================================= ==void DispLine: Display single line on video of main menu... == ==========================================================================*/ void DispLine(String, Row, Col) char *String; int Row; int Col; { int Idx ;/* index into array */ char Slabel[160] ;/* string label */ memset(Slabel,' ',158); Slabel[158]='\0'; Idx = slen(String); while (Idx >=0) { Slabel[Idx] = String[Idx]; Idx--; } (void) xv_create(PhonePanel, PANEL_MESSAGE, PANEL_LABEL_STRING, Slabel, PANEL_LABEL_BOLD, TRUE, XV_X, Col, XV_Y, Row, NULL); }/* end of DispLine */