home *** CD-ROM | disk | FTP | other *** search
- {$M 24000,0,655360}
- Program BoxDemo;
-
- (* 05/02/1988 J Tal
- Rollins Medical/Dental Systems
-
- Public Domain
- *)
-
- Uses Crt,Funcs,DosBios,Fields;
-
-
- VAR
- Cout,Scrf,Scrd: BoxItAryStr;
- vMode,Cout9,Scrf9,Slim,i,w,Scr_type,cursor_field,ii,iii,flen: Integer;
- Colf: IntAry25;
- yn_str,Ed_cur_str,Ed_nor_str,Ed_err_str,Ed_scr_str,cmnd_str,buff_str: st255;
- cols : StrAry25;
- Intens : StrAry4;
- scr_buffer: scr_buffer_type;
- buff_ptr: scr_buffer_ptr;
- rx,ry,rw,rh: BYTE;
-
- Procedure InitFields;
-
- (* Sample col variable initialization *)
- BEGIN
-
- Case Scr_Type OF
- MonoChrome: begin
- colf[fore,0] := 7; colf[back,0] := 0; (* Main Text foreground background *)
- colf[fore,1] := 1; colf[back,1] := 0; (* Editable field passive colors *)
- colf[fore,2] := 0; colf[back,2] := 7; (* Editable field active colors *)
- colf[fore,3] := 0; colf[back,3] := 7; (* Editable field in error (reversed) *)
- colf[fore,4] := 0; colf[back,4] := 7; (* Main Text in reverse *)
- end;
- BlackWhite: begin
- colf[fore,0] := 7; colf[back,0] := 0;
- colf[fore,1] := 0; colf[back,1] := 2;
- colf[fore,2] := 14; colf[back,2] := 0;
- colf[fore,3] := 14; colf[back,3] := 7;
- colf[fore,4] := 0; colf[back,4] := 7;
- end;
- Color: begin
- colf[fore,0] := 7; colf[back,0] := 0;
- colf[fore,1] := 0; colf[back,1] := 2;
- colf[fore,2] := 14; colf[back,2] := 0;
- colf[fore,3] := 7; colf[back,3] := 4;
- colf[fore,4] := 15; colf[back,4] := 1;
- end;
- else
- end;
-
-
- END;
-
-
- BEGIN
-
- ClrScr;
-
- InitFrame;
- buff_ptr := @scr_buffer;
-
- vMode := Get_Vmode;
- IF vMode = 7 THEN
- scr_type := MonoChrome
- ELSE begin
- Write('Is you monitor able to display more than 2 colors? (y/n)');
- ReadLn(yn_str);
- IF Upcase(yn_str[1]) = 'Y' THEN
- scr_type := Color
- ELSE
- scr_type := BlackWhite;
-
- END;
-
- InitFields;
- SetIoCol(scr_type,colf,cols,Intens,Ed_cur_Str,Ed_nor_str,Ed_err_str,Ed_scr_str);
- ClrScr;
- gotoxy(1,24);
- Write('Going to form a backdrop and draw the box. Press <Enter>');
- readln;
- for i := 1 to 24 do begin
- gotoxy(1,i);
- write(rpt(80,ord('▒')));
- end;
-
-
- Gotoxy(2,24); Writeln('<Tab> = next field <Sh-Tab> = prev field <Esc> = erase to end <Ret> = end');
-
-
- (* defining a screen to be output in Cout string array *)
-
- Cout[1] := ' UPDATE THE PHONE TABLE';
- Cout[2] := '─';
- (* ^- ascii 196 means draw horiz line across box *)
- Cout[3] := '';
- Cout[4] := 'BAUD RATE 2400,*1200,300 ____';
- (* ^ all _'s denote
- field position
- and length *)
- Cout[5] := 'WORD LENGTH 8,*7 _';
- Cout[6] := 'STOP BITS *2,1,1 _';
- Cout[7] := 'PARITY *M,N,E,O _';
- Cout[8] := '─';
- Cout[9] := 'SPEAKER STATUS *M1 := ON, M0 := OFF __';
- Cout[10] := 'DIALING METHOD *[T]one,[P]ulse _';
- Cout[11] := 'COM PORT *2,1 _';
- Cout[12] := '─';
- Cout[13] := 'AUTO BILLING PHONE NUMBER _________________________';
- Cout[14] := 'AUTO BILLING PASSWORD _______________';
- Cout[15] := '─';
- Cout[16] := 'UPDATES PHONE NUMBER _________________________';
- Cout[17] := 'UPDATES NAME 1 __________';
- Cout[18] := 'UPDATES NAME 2 __________';
- Cout[19] := 'UPDATES PASSWORD 1 __________';
- Cout[20] := 'UPDATES PASSWORD 2 __________';
- Cout9 := 19;
- (* draw screen and return input field definitions in SCRF *)
- Boxit(-1,-1,Cout,Cout9,1,SCRF,SCRF9,FRAME,colf,scr_type,rx,ry,rw,rh,buff_ptr);
- (* paramater breakdown
-
- Boxit(-1, = screen X pos (-1 = center)
- -1, = screen Y pos (-1 = center)
- Cout, = array of strings to define screen.
- Ascii 196 in string means full horiz bar
- Underscores (Ascii 95) denotes input field
- Cout9, = number of cout[]'s defined
- 1, = spac = line spacing between entries
- Negative values mean line spacing of
- abs(spac) and each line centered
- SCRF, = returned field definitions
- (make sure to dim enough)
- SCRF9, = number of Scrf[]'s returned
- FRAME, = array graphic box defs
- colf, = integer color defs
- scr_type = screen type
- rx,ry,rh,rh = returned box size for subsequent Wput call
- scr_buff_ptr = passed pointer to screen hold buffer which was filled
- in during call to Boxit. Used in subsequent Wput call.
-
- *)
-
- slim := SCRF9;
-
- FOR i := 1 TO slim DO begin
- w := fnval(Copy(scrf[i],9,2));
- scrd[i] := spaces(w);
- END;
-
- (* output fields *)
- FOR i := 1 TO slim DO
- field_out(scr_type,colf[fore,0],colf[back,0],scrf[i],scrd[i]);
-
- TextColor(colf[fore,0]);
- TextBackground(colf[back,0]);
-
- cursor_field := 1;
-
- ii := cursor_field;
-
- (* interactive editing begins, ii is control variable *)
- WHILE ii > -2 DO begin
- (* while return not pressed *)
- cmnd_str := copy(scrf[ii],1,11) + Ed_cur_str; (* current field *)
- iii := ii; (* remember ii in iii cause ii changes *)
- buff_str := scrd[iii]; (* starting input is field's current contents *)
- field_in(scr_type,colf[fore,0],colf[back,0],cmnd_str,buff_str,flen,ii); (* field editing *)
- scrd[iii] := buff_str; (* has been edited *)
- cmnd_str := copy(scrf[iii],1,11) + Ed_nor_str; (* restore field to orig state *)
- field_out(scr_type,colf[fore,0],colf[back,0],cmnd_str,buff_str);
- if ii > slim then ii := 1; (* tab goes to next field, if at end wrap to top *)
- if ii = 0 then ii := slim; (* shift-tab goes to prev field, if at top wrap to bottom *)
- END;
-
- gotoxy(1,24);
- Write(' ':80);
- gotoxy(1,24);
- Write(' Going to restore the original backdrop. Press <Enter>');
- readln;
-
- Wput(rx,ry,rw,rh,buff_ptr);
-
-
-
- END.