home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / strings / infield / intest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-06-06  |  9.3 KB  |  151 lines

  1. program TestInField;        { You won't be able to compile this, since you }
  2.                             { need QWIK.TPU, with the additional routines  }
  3. Uses Crt, qwik, Infield;    { of QBorder and WindFrame.  However, you may  }
  4.                             { get QWIK.TPU and either delete or replace    }
  5. var TestStrg : Strng80;     { those routines with your own.                }
  6.     Choice : char;          { This progam is just intended for reference.  }
  7.  
  8. procedure OutputStuff;      { Outputs all relevant variables.              }
  9. var Temp : Strng80;
  10. begin
  11.    TextAttr := (Magenta shl 4) + White;
  12.    WindFrame( 2, 45,  8, 70, TextAttr, TextAttr, 7);
  13.    QWrite( 3, 46, TextAttr, '<<<<<<<<<<<<<<<<<<<<<<<<');
  14.    TextAttr := (Blue shl 4) + White;
  15.    QWrite( 3, 46, TextAttr, TestStrg);
  16.  
  17.    TextAttr := (Magenta shl 4) + White;
  18.    QWrite( 5, 46, TextAttr, 'IExit:');
  19.  
  20.    TextAttr := (Blue shl 4) + White;
  21.    if IExit = true then QWrite( 5, 53, TextAttr, 'TRUE ') else
  22.                         QWrite( 5, 53, TextAttr, 'FALSE');
  23.  
  24.    TextAttr := (Magenta shl 4) + White;
  25.    QWrite( 7, 46, TextAttr, 'FKey:');
  26.  
  27.    TextAttr := (Blue shl 4) + White;
  28.    Str(Fkey, Temp);
  29.    QWrite( 7, 52, TextAttr, Temp);
  30. end;
  31.  
  32.  
  33. begin
  34.    QBorder(1);   { This routine was written by myself and was added to       }
  35.                  { the Qwik unit.                                            }
  36.    CursorOn;                                       { I must restore the cur- }
  37.    CheckBreak := False;                            { sor and border at exit. }
  38.    TextAttr := (Blue shl 4) + White;               { Set the main text color }
  39.    Qfill  ( 1,  1, 25, 80, TextAttr, ' ');         { Clear the screen        }
  40.    QWrite ( 2,  1, TextAttr, 'Standard Input:  '); { Normal input, nothing   }
  41.    TestStrg := 'This is passed text';              { special.  Pass some     }
  42.    Data_In( 2, 18,  20, TestStrg, TextAttr);       { test text. (say THAT    }
  43.    OutputStuff;                                    { ten times fast!)        }
  44.  
  45.    Qwrite ( 4,  1, TextAttr, 'Keyclick on: ');     { Demo of keyclick.  You  }
  46.    TextAttr := (Red shl 4) + White;                { may note that I never   }
  47.    Kclk := true;                                   { demonstrated the sound  }
  48.    TestStrg := 'This is passed text';              { off mode.               }
  49.    TAttr := (Blue shl 4) + White;                  { Demos using an empty    }
  50.    UseTemp := True;  StCh := '>';  EnCh := 'N';    { template to change the  }
  51.    Template := rep(20, 32);                        { start & end char color. }
  52.    Data_In( 4, 18,  20, TestStrg, TextAttr);       { Run the 'Biggie.'       }
  53.    Kclk := false;  UseTemp := False;               { Turn off the features.  }
  54.    StCh := '[';   EnCh := ']';                     { Restore start & end chr }
  55.    OutputStuff;                                    { Output everything.      }
  56.  
  57.    TextAttr := (Blue shl 4) + White;               { Main screen color.      }
  58.    QWrite ( 6,  1, TextAttr, 'Strip on Exit: ');   { Demo of stripping the   }
  59.    SOE := true;  CapsOnly := true;                 { string of spaces.  I    }
  60.    TextAttr := (Cyan shl 4) + White;               { didn't implement a just }
  61.    TestStrg := 'This is passed text';              { leading or trailing     }
  62.    Data_In( 6, 18, 20, TestStrg, TextAttr);        { spaces strip, because   }
  63.    SOE := false;  CapsOnly := false;               { I'm too lazy.  Also     }
  64.    OutputStuff;                                    { demos the capital       }
  65.                                                    { letters only mode.      }
  66.    TextAttr := (Blue shl 4) + White;               {                         }
  67.    QWrite ( 8,  1, TextAttr, 'Clear on Entry: ');  { Demos the COE mode.     }
  68.    COE := true;                                    { This feature clears the }
  69.    TextAttr := (Magenta shl 4) + White;            { string automatically    }
  70.    TestStrg := 'This is passed text';              { when you call data_in.  }
  71.    Data_In( 8, 18, 20, TestStrg, TextAttr);        { I use this feature      }
  72.    COE := false;                                   { quite a bit.            }
  73.    OutputStuff;                                    { (Is the shadow REAL?)   }
  74.  
  75.    TextAttr := (Blue shl 4) + White;               { Just press return on    }
  76.    QWrite (10,  1, TextAttr, 'ESC on Blank: ');    { a blank line here, and  }
  77.    COE := true;  EOB := true;                      { notice that IExit will  }
  78.    TextAttr := (Green shl 4) + White;              { be set to TRUE.  I use  }
  79.    TestStrg := '';                                 { this quite a bit, also. }
  80.    StCh := '{';  EnCh := '}';                      { I also demonstrate      }
  81.    Data_In(10, 18, 20, TestStrg, TextAttr);        { different starting and  }
  82.    COE := false; EOB := false;                     { ending characters here. }
  83.    OutputStuff;                                    { Show yer stuff. . .     }
  84.  
  85.    TextAttr := (Blue shl 4) + White;               { Reset screen attribute. }
  86.    QWrite (12,  1, TextAttr, 'Exit on Arrow: ');   { Press any arrow key     }
  87.    EOA := true;                                    { here and note that      }
  88.    TextAttr := (Red shl 4) + White;                { IExit = TRUE and that   }
  89.    StCh := 'N';  EnCh := 'N';                      { Fkey is set to the      }
  90.    TestStrg := 'This is passed text';              { proper key #.  Also     }
  91.    Data_In(12, 18, 20, TestStrg, TextAttr);        { demos no leading or     }
  92.    EOA := false;  StCh := '[';  EnCh := ']';       { ending char.            }
  93.    OutputStuff;                                    {                         }
  94.  
  95.    TextAttr := (Blue shl 4) + White;               { First demo of template  }
  96.    QWrite (14,  1, TextAttr, 'Template 1: ');      { use.  Normal entry,     }
  97.    QWrite (14, 40, TextAttr, 'Standard template entry.');
  98.    UseTemp := true;  TAttr := (LightGray shl 4) + White;
  99.    Template := '   /  -    +   -    .  ';          { nothing fancy.  Note    }
  100.    TextAttr := (LightGray shl 4) + Black;          { what happens when you   }
  101.    TestStrg := '';                                 { insert and delete text. }
  102.    Data_In(14, 14, 20, TestStrg, TextAttr);        { Also try any function   }
  103.    OutputStuff;                                    { key, Ctrl, Shift or Alt }
  104.  
  105.    TextAttr := (Blue shl 4) + White;               { Uses the Move On Key    }
  106.    QWrite (16,  1, TextAttr, 'Template 2: ');      { function.  Note that    }
  107.    Qwrite (16, 40, TextAttr, 'Try pressing a key in the template ("+")');
  108.    UseTemp := true;  TAttr := (Magenta shl 4) + LightGray;
  109.    Template := '   /  -    +   -    .  ';  MOK := true;
  110.    TextAttr := (Magenta shl 4) + White;            { there are two dashes in }
  111.    TestStrg := '';                                 { the template, but it    }
  112.    Data_In(16, 14, 20, TestStrg, TextAttr);        { always goes to the one  }
  113.    MOK := false;                                   { immediately to the      }
  114.    OutputStuff;                                    { right of the cursor.    }
  115.  
  116.    TextAttr := (Blue shl 4) + White;               { This feature returns    }
  117.    QWrite (18,  1, TextAttr, 'Template 3: ');      { the template in the     }
  118.    QWrite (18, 40, TextAttr, 'Keeps the template in the string');
  119.    UseTemp := true;  TAttr := (Brown shl 4) + LightCyan;
  120.    KeepTemp := true;                               { string.  Useful if the  }
  121.    Template := '   /  -    +   -    .  ';          { following code needs    }
  122.    TextAttr := (Brown shl 4) + White;              { a reference point in    }
  123.    TestStrg := '';                                 { the string.  For ex.,   }
  124.    Data_In(18, 14, 20, TestStrg, TextAttr);        { you could leave the '/' }
  125.    KeepTemp := false;                              { in a date template to   }
  126.    OutputStuff;                                    { help break it down.     }
  127.                                                    
  128.    TextAttr := (Blue shl 4) + White;               { Does pretty much        }
  129.    QWrite (20,  1, TextAttr, 'Template 4: ');      { everything.  Note that  }
  130.    QWrite (20, 40, TextAttr, 'Both keeps the template & moves on a key.');
  131.    UseTemp := true;  TAttr := (Black shl 4) + LightGray;
  132.    KeepTemp := true;  MOK := true;                 { this passes text, which }
  133.    Template := '   /  -    +   -    .  ';          { is, of course, put into }
  134.    TextAttr := (Black shl 4) + White;              { the template auto-      }
  135.    TestStrg := '001AB1024RLL3352XT';               { matically.              }
  136.    Data_In(20, 14, 20, TestStrg, TextAttr);        { Call the function again }
  137.    KeepTemp := false;  MOK := false;               { Set switches back to    }
  138.    OutputStuff;                                    { normal.                 }
  139.  
  140.    TextAttr := (Blue shl 4) + White;               { Well, that's it.  I     }
  141.    QWrite(22,  1, TextAttr, 'Press any key to exit . . .');
  142.    CursorOn;                                       { could add more, but I   }
  143.    GotoRC(22, 29);                                 { like smaller units.  I  }
  144.    Choice := Readkey;                              { left all of the data    }
  145.    TextAttr := (Black shl 4) + LightGray;          { handling to the         }
  146.    QBorder(0);                                     { programmer, which I     }
  147.    ClrScr;     { feel is an advantage.  Besides, I could use a break . . .   }
  148. end.
  149.  
  150. 
  151.