home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-05 | 2.4 KB | 90 lines | [TEXT/PJMM] |
- { MiniDisplay - TransDisplay Demonstration. Very simple: just}
- { demonstrates the various output calls.}
-
- { The project should include MiniDisplay.p (this file),}
- { TransDisplay.p (or a library made from TransDisplay.p),}
- { TransSkel.p (or a project made from TransSkel.p), Runtime.lib and Interface.lib.}
-
- { 4 October 1986 Paul DuBois}
- { 10 January 1987 Owen Hartnett Lightspeed Pascal version }
- { Ωhm Software, 163 Richard Drive, Tiverton, RI 02878 }
-
- { 2 December 1988 Owen Hartnett Upgrade to LSP 2.0 }
-
- program MiniDisplay;
-
- uses
- {$IFC UNDEFINED THINK_PASCAL}
- Memtypes, Quickdraw, OSIntf, ToolIntf, PackIntf,
- {$ENDC}
- TransSkel, TransDisplay;
-
- procedure DoFileMenu (item: integer); { ignored - there's only Quit }
- begin
- SkelWhoa; { tell SkelMain to quit }
- end;
-
- var
- r: Rect;
- m: MenuHandle;
- w: WindowPtr;
- theStr: Str255;
- myPtr: Ptr;
- dummy: Boolean;
-
- begin
- SkelInit(6, nil); { initialize }
- TransDisplayInit;
- SkelApple('(About MiniDisplay…', nil); { handle desk accessories }
-
- m := NewMenu(2, 'File'); { create menu }
- AppendMenu(m, 'Quit/Q');
- dummy := SkelMenu(m, @DoFileMenu, nil, true); { tell TransSkel to handle it }
-
-
- SetRect(r, 100, 75, 400, 250);
- w := NewDWindow(r, 'MiniDisplay', false, WindowPtr(-1), false, longint(0));
-
- DisplayString('This is MiniDisplay, a minimal demonstration of');
- Displayln;
- DisplayString('TransDisplay. The following types of output may');
- Displayln;
- DisplayString('be written with the built-in output calls:');
-
- Displayln;
- DisplayString('Arbitrary length text:');
- theStr := 'Some Text';
- myPtr := Ptr(longint(@theStr) + 1);
- DisplayText(myPtr, longint(length(theStr)));
- Displayln;
- DisplayString('String:');
- DisplayString('"this is a string"');
- Displayln;
- DisplayString('Char: ');
- DisplayChar('x');
- DisplayString(' Hex char: ');
- DisplayHexChar('x');
- Displayln;
- DisplayString(' Int: ');
- DisplayInt(1023);
- DisplayString(' Hex int: ');
- DisplayHexInt(1023);
- Displayln;
- DisplayString(' Long: ');
- DisplayLong(longint(32768));
- DisplayString(' Hex long: ');
- DisplayHexLong(longint(32768));
- DisplayString(' Boolean: ');
- DisplayBoolean(true);
- DisplayString(', ');
- DisplayBoolean(false);
- Displayln;
- DisplayString('Carriage Return: ');
- Displayln;
- DisplayString('Select quit from the File menu to exit');
- SetDWindowPos(w, 0); { scroll back to top }
- ShowWindow(w);
-
- SkelMain; { loop 'til Quit selected }
- SkelClobber; { clean up }
- end.