home *** CD-ROM | disk | FTP | other *** search
- procedure Prompt(Line1,Line2: str255);
- { Display prompt lines on bottom 2 lines of Video }
- begin
- gotoXY(1,23); ClrEol; writeln(Line1); ClrEol; write(Line2);
- end;
-
- procedure Say_Prompt(Prompt_num : integer);
- { Programmer defined prompts for bottom 2 lines of Video }
- var Line1,Line2 : string[80];
- begin
- Line2 := 'Press <F1> to change the last entry';
- Case Prompt_num of
- 1 : Line1 := '';
- 2 : begin
- Line1 := 'Enter anything you wish or';
- Line2 := 'Press the <F1> key to exit this section...';
- end;
- 3 : Line1 := 'This is the second prompt';
- 4 : Line1 := 'All prompts are programmer defined';
- 5 : Line1 := 'This is the last prompt';
- end;
- prompt(Line1,Line2);
- end;
-
- procedure Get_Default(Default_num : integer; var Default : str80);
- { Default values for the Input_Handler are handled here }
- begin
- Case Default_num of
- 1 : Default := '';
- 2 : Default := FilVar[1];
- end;
- end;
-
- procedure Do_Validation(Valid_num : integer; var Valid : boolean);
- { Validation of user inputs is done here }
- var S : str80;
- Cd,I : integer;
- N : Real;
- begin
- Valid := true;
- Case Valid_num of
- 1 : ;
- 2 :begin
- val(copy(Answer,4,2),I,Cd); if I>31 then Valid := false;
- end;
- 3 :begin
- end;
- end; { case }
- end; { procedure }
-
-
- procedure Input_Handler(IpCode: str5; var Escape: boolean);
- { Handles all input and editing for a page of inputs }
- { requires procedures
- Say_Prompt, Do_Validation, Get_Default
- global variables
- Filvar: array of [1..25] of string[80] }
- label 100;
-
- var Typ,IpType,uppercase : Char;
- Default,Template : str80;
-
- Row,Col,Mlen,I,Code,Count,
- First_var_num,Last_var_num,
- Filvar_num,
- Default_num,Prompt_num,Validation_num : integer;
-
- F1,F10,Valid,UCase : boolean;
-
- procedure Get_Var;
- begin
- val(copy(P[count],1,2), Col,Code);
- val(copy(P[count],3,2), Row,Code);
- Typ := copy(P[count],5,1);
- val(copy(P[count],6,3), Mlen,Code);
- val(copy(P[count],9,2), Filvar_num,Code);
- upperCase := copy(P[count],11,1);
- val(copy(P[count],12,2),Default_num,Code);
- val(copy(P[count],14,2),Prompt_num,Code);
- val(copy(P[count],16,2),Validation_num,Code);
- if upperCase= 'T' then UCase:= true else UCase:= false;
- end;
-
- procedure Display_Rec;
- var I : integer;
- begin
- HighVideo;
- for I:= first_var_num to last_var_num do
- begin
- if Iptype <> 'N' then
- begin
- Count:= I; Get_Var;
- gotoXY(col,row); write(Filvar[Filvar_num]);
- end;
- end; { for loop }
- end;
-
- begin
- IpType := copy(IpCode,1,1);
- val(copy(IpCode,2,2),First_Var_num,Code);
- val(copy(Ipcode,4,2),Last_var_num,Code);
- Case IpType of
- 'N' : for I:= 1 to 25 do Filvar[I] := '';
- 'C' : ;
- end; { Case }
- count := First_var_Num; F1:=false; F10:=false;
- if IpType = 'D' then Display_rec
- else
- begin
- if IpType = 'C' then
- begin
- gotoXY(1,25);clreol;
- InvVideo('Press <F10> to EXIT changes or <Esc> to change an entry');
- Say_Cap_num;
- end;
- repeat
- Get_Var; template:='';
- 100: if Filvar[count] = '' then Get_Default(Default_num,Default)
- else Default := Filvar[count];
- HighVideo; Say_Prompt(Prompt_num);
-
- Input(Typ,Default,Col,Row,Mlen,UCase,F1,F10);
- { F1 and F10 is returned from Input }
-
- if (IpType = 'C') and (F10) then
- begin Exit := true; F10:= false; end
- else
- begin
- Do_validation(Validation_num,Valid);
- {Valid returned from Do_Validation: if not Valid then entry is redone}
- if not valid then
- begin
- Default:=''; Filvar[count]:=''; Beep(350,150);
- goto 100; { 100 is the input procedure above (in this procedure) }
- end; { do not use default }
- Filvar[count] := Answer;
- if F1 then
- begin
- gotoXY(col,row); HighVideo;
- if Filvar[count]<>''then write(Filvar[count])
- else write(template);
- count:=count-1; F1:=false;
- end else count:=count+1;
- if count<First_var_num then begin Escape:=true; Exit:=true; end else
- if count>Last_var_num then begin Escape:=false; Exit:=true; end else
- Exit:=false;
- end;
- until Exit = true;
- if count > first_var_num then Escape:= false;
- if IpType = 'C' then begin gotoXY(1,25); clreol; end;
- end; { typ <> 'D' }
- Exit:=false;
- end;