home *** CD-ROM | disk | FTP | other *** search
- { WTUTOR32.PAS - demonstration program for WINDOW32.INC ver 3.2, 02-20-87 }
-
- program WindowTutor;
-
- {$i Qwik21.inc}
-
- Const MaxWndw = 30; { Define storage area for Max number of window stats }
- {$I Window32.inc}
-
- var i,j,k,m: integer;
- OldCursor,Battr: integer;
-
- const
- stra : array [1..16] of str80 = (
- '',
- 'The windowing procedures in the file WINDOW32.INC',
- 'are a set of public domain routines that allow',
- 'Turbo PASCAL to create incredibly fast multi-level',
- 'windows. Created under the Teamware concept,',
- 'WINDOW32.INC makes use of the quick screen writing',
- 'utilities of QWIK21.INC. The windows may be of',
- 'any size (from 2x2 to screen limits) and color,',
- 'and may have one of several different border',
- 'styles and colors including no border. They also',
- 'work in any column mode 40/80/etc. Once inside a',
- 'window, the normal Turbo PASCAL procedures',
- '"TextColor" and "TextBackground" may be used to',
- 'change character attributes. These routines',
- 'automatically configure to your video card and',
- 'mode.');
-
- strb : array [1..13] of str80 = (
- '',
- 'The window procedures package consists of four procedures;',
- ' InitWindow, MakeWindow, RemoveWindow and TitleWindow.',
- 'The procedures are described in the following windows:',
- '',
- 'InitWindow',
- '',
- 'FORMAT: InitWindow (WindowAttribute: byte);',
- '',
- 'InitWindow initializes several variables required by the',
- 'windowing package, as well as selecting the foreground and',
- 'background colors of the initial screen display. InitWindow',
- 'must be called before using any of the other procedures.');
-
- strc : array [1..17] of str80 = (
- 'MakeWindow',
- '',
- 'FORMAT: MakeWindow (Row,Col,Rows,Cols,Wattr,Battr: byte;',
- ' BrdrSel: borders);',
- '',
- 'MakeWindow puts a new blank window on the display. The window starts',
- 'at the upper left corner (row,col) and extends for a number of rows',
- 'and columns (rows,cols). If a border exists, the actual dimensions',
- 'of the Turbo window will be 2 less than indicated in the MakeWindow',
- 'statement. The border can be one of the following:',
- '',
- ' NoBrdr - just window EvenSolidBrdr - evenly solid',
- ' BlankBrdr - blank spaces ThinSolidBrdr - thin solid line',
- ' SingleBrdr - single line LhatchBrdr - light hatch',
- ' DoubleBrdr - double line MhatchBrdr - medium hatch',
- ' MixedBrdr - single/double HhatchBrdr - heavy hatch',
- ' SolidBrdr - solid UserBrdr - user defined border');
-
- strk : array [1..19] of str80 = (
- '',
- '',
- ' ScrollWindow',
- '',
- '',
- 'FORMAT: ScrollWindow (RowBegin,RowEnd: byte; Dir: DirType);',
- '',
- 'Turbo''s standard procedures InsLine and DelLine work just fine in',
- 'these windows on video page 0 and are recommended. However, if you',
- 'are working on other video pages or in special column modes, then',
- 'this procedure wil do the same thing. In addition, this will also do',
- 'partial windows.',
- '',
- 'The direction of scroll can be either of the following:',
- '',
- ' ''Up'' - to scroll up',
- ' ''Down'' - to scroll down',
- '',
- '');
-
- strd : array [1..6] of str80 = (
- 'RemoveWindow',
- 'FORMAT: RemoveWindow;',
- '',
- 'RemoveWindow removes the last window',
- 'remaining on the screen from the',
- 'MakeWindow procedure.');
-
- stre : array [1..6] of str80 = (
- 'TitleWindow',
- 'FORMAT: TitleWindow (Justify, Title);',
- '',
- 'TitleWindow places a title in the top border',
- 'of the current window. Justify permits Left,',
- 'Center or Right justification of the title.');
-
- strj : array [1..17] of str80 = (
- 'There are now two special effects that can',
- 'enhance the window display:',
- ' ZoomEffect - emulates the MacIntosh.',
- ' ShadowEffect - places a left or right',
- ' shadow underneath the menu.',
- 'These global variables can be placed anywhere',
- 'in your program. ZoomEffect is boolean while',
- 'ShadowEffect is of DirType.',
- 'CGA:',
- 'The CGA is self-regulating and controls the',
- 'zoom rate.',
- 'MDA and EGA:',
- 'These video cards are quite fast and need a',
- 'delay for the effect. A default value of 11',
- 'milliseconds is used in a typed constant',
- 'named ''ZoomDelay'' and shouldn''t need any',
- 'adjustment.');
-
- strf : array [1..6] of str80 = (
- '',
- ' The maximum number of windows that',
- ' may be on the screen at any one time',
- ' is specified by the constant',
- ' "MaxWndw". Assign it in your program',
- ' before including $I WINDOW32.INC.');
-
- stri : array [1..9] of str80 = (
- ' In addition to windows, there are 15 powerful',
- ' Q screen write procedures you can use:',
- ' QwriteLV QfillC QstoreToMem',
- ' QwriteV Qfill QstoreToScr',
- ' Qwrite Qattr QviewPage',
- ' QwriteC QattrC QwritePage',
- ' QwriteCV GotoRC CursorChange ',
- ' In QWIK21.ARC, compile and run QDEMO.PAS to see',
- ' all of the features.');
-
- strg : array [1..20] of str80 = (
- ' The procedures are used as follows:',
- '',
- ' program YourProgram;',
- ' {$I Qwik21.inc}',
- ' const MaxWndw = ??? { Max # of windows }',
- ' {$I Window32.inc}',
- ' ...Your variables and procedures...',
- ' begin',
- ' .',
- ' InitWindow (WindowAttribute);',
- ' .',
- ' MakeWindow (Row,Col,Rows,Cols,Wattr,Battr,',
- ' BrdrSel);',
- ' TitleWindow (Justify,''the window title'');',
- ' .',
- ' RemoveWindow;',
- ' .',
- ' end.',
- '',
- ' { Use one RemoveWindow for each MakeWindow. }');
-
- strh : array [1..7] of str80 = (
- 'If you have any questions or comments,',
- 'please write to or call:',
- '',
- ' Jim H. LeMay',
- ' 6341 Klamath Rd.',
- ' Ft. Worth, TX 76116',
- ' (817)735-4833 (after 1730 CST)');
-
- Title: str160 = ' Turbo PASCAL Windows (Continued) ';
- HideCursor: integer = $2020; { Value to hide cursor }
-
- begin
- InitWindow (Attr(blue,cyan));
- CursorChange (HideCursor,OldCursor);
- GotoRC (1,1);
-
- { -- Throw out 30 windows 4 times -- }
- for m:=1 to 4 do
- begin
- for i:=1 to 30 do
- begin
- j := random (70);
- k := random (21);
- MakeWindow (k+1,j+1,5,11,Attr(yellow,red),Attr(yellow,red),LhatchBrdr);
- Qwrite (k+3,j+3, -1,'WINDOWS');
- end;
- if m=4 then delay (1500) else delay (300);;
- for i:=LI downto 1 do RemoveWindow;
- end;
-
- { -- Create initial screen -- }
- QwriteC ( 1, 1,80, -1,'Turbo PASCAL Windows Tutorial');
- TextColor (black);
- QwriteC ( 3, 1,80,Tattr,'For each of the following displays,');
- QwriteC ( 4, 1,80,Tattr,'press RETURN to continue.');
- QwriteC (12, 1,80,Tattr,'This is the original screen without windows.');
- readln;
-
- { -- General description -- }
- ShadowEffect:=Right;
- MakeWindow (3,15,19,52,Attr(black,green),Attr(black,green),MixedBrdr);
- TitleWindow (Center,' Turbo PASCAL Windows ');
- For j :=1 to 16 do QwriteV (j+3,16,Attr(black,green),stra[j]);
- readln;
- ShadowEffect:=NoDir;
-
- { -- InitWindow description -- }
- MakeWindow (5,2,16,61,Attr(yellow,red),Attr(yellow,red),SingleBrdr);
- TitleWindow (Left,Title);
- For j :=1 to 5 do QwriteV (j+5,3,Attr(yellow,red),strb[j]);
- QwriteV (11,4,Attr(white,blue),strb[6]);
- For j :=7 to 9 do QwriteV (j+5,3,Attr(cyan,red),strb[j]);
- For j :=10 to 13 do QwriteV (j+5,3,Attr(white,red),strb[j]);
- readln;
-
- { -- MakeWindow description -- }
- MakeWindow (4,7,21,71,Attr(lightmagenta,blue),Attr(lightmagenta,blue),
- SolidBrdr);
- TitleWindow (Left,Title);
- QwriteV (6,12,Attr(yellow,red),strc[1]);
- For j :=2 to 4 do QwriteV (j+5,8,Attr(lightred,blue),strc[j]);
- For j :=5 to 17 do QwriteV (j+5,8,Attr(yellow,blue),strc[j]);
- readln;
- for j :=1 to 19 do InsLine;
- for j :=1 to 19 do
- begin
- ScrollWindow (1,19,up);
- QwriteV (23, 8,-1,StrK[j])
- end;
- readln;
-
- { -- Show different borders -- }
- for i:=0 to 5 do
- begin
- if i=1 then Battr:=Attr(yellow,yellow) else Battr := Attr(yellow,green);
- MakeWindow (2+2*i,13+3*i,5,10,Attr(yellow,green),Battr,Borders(i));
- end;
- with Brdr[UserBrdr] do
- begin
- TL := ^O;
- TH := ^O;
- TR := ^O;
- LV := '▐';
- RV := '▌';
- BL := ^O;
- BH := ^O;
- BR := ^O
- end;
- for i:=6 to 11 do
- MakeWindow (24-2*i,24+3*i,5,10,Attr(yellow,green),Battr,Borders(i));
- readln;
-
- { -- RemoveWindow description -- }
- MakeWindow (11,20,11,40,Attr(black,brown),Attr(black,brown),DoubleBrdr);
- TitleWindow (Left,Title);
- QwriteV (13,26,Attr(white,magenta),strd[1]);
- QwriteV (15,22,Attr(yellow,brown),strd[2]);
- For j :=3 to 6 do QwriteV (j+13,22,Attr(white,brown),strd[j]);
- readln;
- for i:=0 to 12 do RemoveWindow;
-
- { -- TitleWindow description -- }
- ZoomEffect:=true;
- MakeWindow (12,16,11,49,Attr(red,lightgray),Attr(red,lightgray),
- EvenSolidBrdr);
- TitleWindow (Left,Title);
- QwriteV (14,22,Attr(lightgreen,blue),stre[1]);
- QwriteV (16,18,Attr(black,lightgray),stre[2]);
- For j :=3 to 6 do QwriteV (j+14,18,Attr(green,lightgray),stre[j]);
- readln;
-
- { -- Special effects description -- }
- ShadowEffect:=Right;
- MakeWindow ( 6,25,14,49,Attr(black,green),Attr(white,green),DoubleBrdr);
- TitleWindow (Center,' Special Effects ');
- For j:=1 to 2 do QwriteV (j+7,27,-1,strj[j]);
- For j:=3 to 5 do QwriteV (j+8,27,Attr(white,green),strj[j]);
- For j:=6 to 8 do QwriteV (j+9,27,-1,strj[j]);
- readln;
- Qfill ( 8,27,10,45,Attr(black,green),' ');
- QwriteV ( 8,27,Attr(white,green),strj[9]);
- For j:=10 to 11 do QwriteV (j-1,27,-1,strj[j]);
- QwriteV (12,27,Attr(white,green),strj[12]);
- For j:=13 to 17 do QwriteV (j,27,-1,strj[j]);
- readln;
- ShadowEffect:=NoDir;
-
- { -- MaxWndw constant -- }
- MakeWindow (17, 9, 7,38,Attr(black,brown),Attr(black,brown),NoBrdr);
- TitleWindow (Center,'- WINDOW LIMITS -');
- For j :=1 to 6 do QwriteV (j+16, 9,Attr(black,brown),strf[j]);
- readln;
-
- { -- QWIK21.INC procedures -- }
- MakeWindow (8,20,15,51,Attr(yellow,red),Attr(yellow,red),EvenSolidBrdr);
- TitleWindow (Center,' Utility Procedures ');
- For j :=1 to 2 do QwriteV (j+ 9,21,Attr(yellow,red),stri[j]);
- For j :=3 to 7 do QwriteV (j+10,21,Attr(white,red),stri[j]);
- For j :=8 to 9 do QwriteV (j+11,21,Attr(yellow,red),stri[j]);
- readln;
-
- { -- Programming for WINDOW32.INC -- }
- MakeWindow (2,25,23,50,Attr(yellow,magenta),Attr(yellow,magenta),
- MhatchBrdr);
- For j :=1 to 20 do QwriteV (j+3,26,Attr(yellow,magenta),strg[j]);
- readln;
-
- { -- Editor for WINDOW32.INC -- }
- ZoomEffect:=false;
- ShadowEffect:=Right;
- MakeWindow (8,20,11,42,Attr(black,brown),Attr(black,brown),HhatchBrdr);
- TitleWindow (Center,' Teamware Editor: ');
- For j :=1 to 7 do QwriteV (j+9,22,Attr(white,brown),strh[j]);
- readln;
-
- { -- Use the following statment to return to the original screen.-- }
- for i:=1 to LI do RemoveWindow;
- Qfill (1,1,25,80,Tattr,' ');
- QwriteC (12,1,80,Tattr,'This concludes the windows tutorial...');
- delay (2000);
- ShadowEffect := NoDir; { Optional termination }
- CursorChange (OldCursor,OldCursor);
- NormVideo;
- ClrScr
- end.