home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Shareware City / Developers / TransSkel Pascal 2.5 / TransDisplay / MiniDisplay.p < prev    next >
Encoding:
Text File  |  1994-12-05  |  2.4 KB  |  90 lines  |  [TEXT/PJMM]

  1. {    MiniDisplay - TransDisplay Demonstration.  Very simple:  just}
  2. {    demonstrates the various output calls.}
  3.  
  4. {    The project should include MiniDisplay.p (this file),}
  5. {    TransDisplay.p (or a library made from TransDisplay.p),}
  6. {    TransSkel.p (or a project made from TransSkel.p), Runtime.lib and Interface.lib.}
  7.  
  8. {    4 October 1986        Paul DuBois}
  9. {    10 January 1987        Owen Hartnett    Lightspeed Pascal version    }
  10. {    Ωhm Software, 163 Richard Drive, Tiverton, RI 02878                }
  11.  
  12. {    2 December 1988    Owen Hartnett    Upgrade to LSP 2.0            }
  13.  
  14. program MiniDisplay;
  15.  
  16.     uses
  17. {$IFC UNDEFINED THINK_PASCAL}
  18.         Memtypes, Quickdraw, OSIntf, ToolIntf, PackIntf, 
  19. {$ENDC}
  20.         TransSkel, TransDisplay;
  21.  
  22.     procedure DoFileMenu (item: integer);        { ignored - there's only Quit }
  23.     begin
  24.         SkelWhoa;                { tell SkelMain to quit }
  25.     end;
  26.  
  27.     var
  28.         r: Rect;
  29.         m: MenuHandle;
  30.         w: WindowPtr;
  31.         theStr: Str255;
  32.         myPtr: Ptr;
  33.         dummy: Boolean;
  34.  
  35. begin
  36.     SkelInit(6, nil);                    { initialize }
  37.     TransDisplayInit;
  38.     SkelApple('(About MiniDisplay…', nil);        { handle desk accessories }
  39.  
  40.     m := NewMenu(2, 'File');        { create menu }
  41.     AppendMenu(m, 'Quit/Q');
  42.     dummy := SkelMenu(m, @DoFileMenu, nil, true);    { tell TransSkel to handle it }
  43.  
  44.  
  45.     SetRect(r, 100, 75, 400, 250);
  46.     w := NewDWindow(r, 'MiniDisplay', false, WindowPtr(-1), false, longint(0));
  47.  
  48.     DisplayString('This is MiniDisplay, a minimal demonstration of');
  49.     Displayln;
  50.     DisplayString('TransDisplay.  The following types of output may');
  51.     Displayln;
  52.     DisplayString('be written with the built-in output calls:');
  53.  
  54.     Displayln;
  55.     DisplayString('Arbitrary length text:');
  56.     theStr := 'Some Text';
  57.     myPtr := Ptr(longint(@theStr) + 1);
  58.     DisplayText(myPtr, longint(length(theStr)));
  59.     Displayln;
  60.     DisplayString('String:');
  61.     DisplayString('"this is a string"');
  62.     Displayln;
  63.     DisplayString('Char: ');
  64.     DisplayChar('x');
  65.     DisplayString('    Hex char:  ');
  66.     DisplayHexChar('x');
  67.     Displayln;
  68.     DisplayString(' Int: ');
  69.     DisplayInt(1023);
  70.     DisplayString('    Hex int:  ');
  71.     DisplayHexInt(1023);
  72.     Displayln;
  73.     DisplayString('  Long: ');
  74.     DisplayLong(longint(32768));
  75.     DisplayString('  Hex long:  ');
  76.     DisplayHexLong(longint(32768));
  77.     DisplayString('  Boolean:  ');
  78.     DisplayBoolean(true);
  79.     DisplayString(', ');
  80.     DisplayBoolean(false);
  81.     Displayln;
  82.     DisplayString('Carriage Return: ');
  83.     Displayln;
  84.     DisplayString('Select quit from the File menu to exit');
  85.     SetDWindowPos(w, 0);    { scroll back to top }
  86.     ShowWindow(w);
  87.  
  88.     SkelMain;                    { loop 'til Quit selected }
  89.     SkelClobber;                    { clean up }
  90. end.