home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / OPBONUS.ZIP / CACHE.LZH / CDEMO.PAS next >
Encoding:
Pascal/Delphi Source File  |  1990-08-27  |  1.1 KB  |  47 lines

  1. program CacheDemo;
  2.  
  3. uses
  4.   OpCmd,
  5.   OpString,
  6.   OpCrt,
  7.   OpFrame,
  8.   OpWindow,
  9.   OpPick,
  10.   PkCache;
  11.  
  12. var
  13.   DemoPick : CachedPickList;
  14.  
  15.   {$F+}
  16.   procedure DemoStrProc(Item : Word; Mode : pkMode; var IType : pkItemType; var IString : String; PickPtr : PickListPtr);
  17.   begin
  18.     {Simulate a slow device to obtain the pick string}
  19.     FastWrite(Center('Item #'+Long2Str(Item)+' not in cache.', ScreenWidth), ScreenHeight, 1, 7);
  20.     Sound(100);
  21.     Delay(5);
  22.     NoSound;
  23.     Delay(150);
  24.     FastFill(ScreenWidth, ' ', ScreenHeight, 1, 7);
  25.  
  26.     {Return the string}
  27.     IString := 'This is a cache test #'+Pad(Long2Str(Item), 5);
  28.   end;
  29.   {$F-}
  30.  
  31.  
  32. begin
  33.   TextAttr := 7; ClrScr;
  34.   with DemoPick do
  35.     begin
  36.       InitCustom(28, 8, 54, 17, DefaultColorSet, wClear+wBordered,
  37.                  27, 30, DemoStrProc, PickVertical, SingleChoice, 15);
  38.       wFrame.AddHeader(' DEMO PICK CACHE ', heTC);
  39.       repeat
  40.         Process;
  41.         if (GetLastCommand = ccSelect) then pkCache.FlushCache;
  42.       until (GetLastCommand = ccQuit);
  43.       Erase;
  44.       Done;
  45.     end;
  46. end.
  47.