home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 18 / CD_ASCQ_18_111294_W.iso / dos / prg / pas / pscrn55 / pascal.exe / DEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1994-10-09  |  3KB  |  87 lines

  1. {***************************************************************************
  2.  
  3.    Demo.Pas          P-Screen demo.  Copyright 1994,  Rob W. Smetana
  4.  
  5.    NOTE:  UN-REM 1 line below (under USES ...) depending on whether you
  6.           use TP 7.x or TP 6.x.
  7.  
  8.  
  9.    Purpose:          Create a "mini presentation" with just a few lines
  10.                      of code and a P-Screen screen library.
  11.  
  12.                      Possible uses:  program demos, tutorials,
  13.                      "electronic letters" (thank you messages,
  14.                      introductions, etc.), "soft ads," etc.
  15.  
  16.    Requires:
  17.  
  18.     1. PScreen.Pas -- a unit which declares our procedures and functions.
  19.  
  20.     2. PScreen.Obj -- assembler procedures.
  21.  
  22.     3. Unit LoadScr?.Tpu which includes:  ("?" = "6" (TP 6.x) or "7" (TP 7.x))
  23.  
  24.           Function DisplayScreen(LibName, ScreenName: String,
  25.                                  ScreenNumber: Integer) : Integer;
  26.           Function NumberScreensInLib (LibName): Integer;
  27.  
  28.     4. A P-Screen screeen library (e.g., Lessons.PSL).
  29.  
  30. ***************************************************************************}
  31.  
  32. Uses Crt,
  33.  
  34. (* NOTE:  TP 7.x users:  UN-REM the next line. *)
  35.  
  36.      LoadScr7, { functions DisplayScreen, LoadScreen, NumberScreensInLib }
  37.  
  38.  
  39. (* NOTE:  TP 6.x users:  UN-REM the next line. *)
  40. (*
  41.      LoadScr6, { functions DisplayScreen, LoadScreen, NumberScreensInLib }
  42. *)
  43.  
  44.      PScreen;  { declares functions and procedures -- especially ASM ones }
  45.                { NOTE:  All ASM functions MUST be declared FAR!           }
  46.  
  47. Var
  48.    LibName : String [64];    { Library name.  Include path if appropriate.  }
  49.    ScrnName: String [8];     { Screen names MUST be upper case; 8 char. max.}
  50.    NumberScreens,ScreenNumber, ErrorCode :Integer;
  51.    Ky : Char;
  52.  
  53. Begin
  54.  
  55.     ClrScr;
  56.  
  57.     LibName := 'Lessons';    { here we'll display screens from Lessons.Psl }
  58.  
  59.     { how many screens are there? }
  60.  
  61.     NumberScreens := NumberScreensInLib (LibName);
  62.     If NumberScreens < 1 Then   { returns -999 if screen library wasn't found }
  63.        Begin
  64.          Clrscr; Write   (' I can''t find screen library: ',LibName);
  65.          Halt;
  66.        end;
  67.  
  68.     For ScreenNumber := 1 to NumberScreens Do
  69.      Begin
  70.  
  71.       { Display screens by number!  Note blank screen name.}
  72.  
  73.       ErrorCode := DisplayScreen(LibName, '', ScreenNumber);
  74.       If ErrorCode < -1 Then
  75.          Begin
  76.            Clrscr;
  77.            Write   (' Sorry.  Error ', ErrorCode,' occurred displaying screen from: ',LibName);
  78.            ReadKey; Halt;
  79.          End;
  80.       Ky := ReadKey;
  81.       If Ky = #27 then Halt;     { end if they press Escape }
  82.     End;
  83.  
  84.     ClrScr;
  85. End.
  86.  
  87.