home *** CD-ROM | disk | FTP | other *** search
- Program Illustrating_the_Toolkit;
- {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { This is the main demonstration program in Technojocks Turbo }
- { Toolkit. The compiled version is in TTTDemo.Com. }
- { }
- { Please distribute the toolkit to anyone and everyone -- but }
- { all the files must be distributed together and they should }
- { not be altered. Enough Crap! }
- { }
- { Bitches, gripes, thanks, kisses, donations to }
- { }
- { Bob Ainsbury, }
- { Technojock, }
- { P.O. Box 2197, }
- { Houston TX 77252 }
- { }
- { "In the software business since Tuesday" }
- { }
- {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
-
- {$I Decl.ttt}
- {$I Fastwrit.TTT}
- {$I Window.TTT}
- {$I Misc.TTT}
- {$I IO.TTT}
- {$I Menu.TTT}
-
- var
- Main_Choice,Choice,Error : integer;
- M1 : Menu_record;
- Const Author = 'Bob Ainsbury, Technojock';
-
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { T H E M A I N M E N U P R O C E D U R E S }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Define_Menu1;
- begin
- With M1 do
- begin
- Heading := 'Turbo Toolkit Menu';
- Text[1] := 'The Toolkit explained';
- Text[2] := 'Fastwrit.TTT Procedures';
- Text[3] := 'Window.TTT Procedures';
- Text[4] := 'Menu.TTT Procedures';
- Text[5] := 'IO.TTT Procedures & Demo';
- Text[6] := 'Misc.TTT Procedures';
- Text[7] := 'Print documentation';
- Text[8] := 'Help';
- Text[9] := 'Quit to DOS';
- TotalPicks := 9;
- PicksPerLine := 1; {one column of choices}
- Addprefix := 3; {add function key prefixes}
- TopleftXY[1] := 0; {system will center menu}
- TopleftXY[2] := 3; {Y coordinate}
- Boxtype := 2; {double box}
- Colors[1] := white; {hi forground}
- Colors[2] := blue; {hi background}
- Colors[3] := red; {lo foreground}
- Colors[4] := lightgray; {lo background}
- Colors[5] := blue; {box color}
- AllowEsc := false; {inactivate the escape key}
- end; {with M1 do}
- end; {Define_Menu1}
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 1 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Toolkit_Explained;
- const
- X1 = 1;
- Y1 = 1;
- X2 = 80;
- Y2 = 20;
- C1 = Lightgreen;
- C2 = black;
- C3 = yellow;
- begin
- Mkwin(X1,Y1,X2,Y2,C1,C2,4);
- OffCursor;
- WriteCenter(Y1,C1,C2,' THE TOOLKIT EXPLAINED ');
- WriteAT(X1+5,Y1+2,C3,C2,
- 'The Toolkit is a productiviity aid for programming in Turbo Pascal');
- WriteAT(X1+5,Y1+3,C3,C2,
- 'and can be used by novice and expert programmer alike.');
- WriteAT(X1+5,Y1+5,C3,C2,
- 'I developed the Toolkit to help me speed up the development time of');
- WriteAT(X1+5,Y1+6,C3,C2,
- 'my programs. Most of the work I undertake is screen IO related and');
- WriteAT(X1+5,Y1+7,C3,C2,
- 'so the Toolkit is biased to these tasks. There is an extensive user');
- WriteAT(X1+5,Y1+8,C3,C2,
- 'guide which details how to use all the procedures and functions in ');
- WriteAT(X1+5,Y1+9,C3,C2,
- 'the Toolkit -- select option 7 from the main menu to get a printout.');
- WriteAT(X1+5,Y1+11,C3,C2,
- 'The whole of this demonstration program was built very quickly using');
- WriteAT(X1+5,Y1+12,C3,C2,
- 'the Toolkit. The Toolkit is actually a set of files ending with a TTT');
- WriteAT(X1+5,Y1+13,C3,C2,
- 'extension (plus some demonstration files like this one). All you have ');
- WriteAT(X1+5,Y1+14,C3,C2,
- 'to do is include the necessary TTT files with a {$I} directive and call');
- WriteAT(X1+5,Y1+15,C3,C2,
- 'the procedure. Refer to the Toolkit manual for a full explanation.');
- WriteAT(X1+17,Y1+17,C1,C2,
- 'Enjoy.....');
- WriteAT(X1+28,Y1+18,white,C2,
- 'Bob Ainsbury, Technojock, Houston (713) 293-2760');
- WriteAT(X2-20,Y2,C1,C2,' press any key ... ');
- Wait_For_Keypress(Ch);
- Rmwin;
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 2 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Explain_Fastwrite;
- const
- X1 = 1;
- Y1 = 1;
- X2 = 80;
- Y2 = 25;
- C1 = white;
- C2 = yellow;
- C3 = black;
- Max_Picks = 16;
-
- Procedure MainText;
- begin
- Box(X1,Y1,X2,Y2,C2,C3,1);
- Horizline(3,77,19,red,black,1);
- WriteCenter(Y1+1,C2,C3,'Fastwrit.TTT');
- WriteAT(X1+5,Y1+3,C1,C3,
- 'The Fastwrit.TTT file contains a host of procedures for updating');
- WriteAT(X1+5,Y1+4,C1,C3,
- 'the screen and controlling the cursor.');
- WriteAT(X1+5,Y1+6,C1,C3,
- 'The procedures revolve around an Inline method of writing directly to');
- WriteAT(X1+5,Y1+7,C1,C3,
- 'video memory and are therefore very machine dependent. They will ');
- WriteAT(X1+5,Y1+8,C1,C3,
- 'work on IBM and true compatible PC''s. If this demo is working then');
- WriteAT(X1+5,Y1+9,C1,C3,
- 'the procedures are OK on this machine!');
- WriteAT(X1+5,Y1+11,C1,C3,
- 'Listed below are some of the main Fastwrit procedures, move the cursor');
- WriteAT(X1+5,Y1+12,C1,C3,
- 'to see a fuller description. Press [End] or [Esc] to return to the menu.');
- end; {sub proc Main_text}
-
- Procedure WriteOption(Pick,F,B:integer);
- const
- Lineone = 15;
- LeftTab = 6;
- Tab = 18;
- begin
- Case Pick of
- 1 : WriteAT(LeftTab,Lineone,F,B, ' Box ');
- 2 : WriteAT(LeftTab+Tab,Lineone,F,B, ' HorizLine ');
- 3 : WriteAT(LeftTab+2*Tab,LineOne,F,B, ' VertLine ');
- 4 : WriteAT(LeftTab+3*Tab,LineOne,F,B, ' WriteAT ');
- 5 : WriteAT(LeftTab,LineOne+1,F,B, ' ClearText ');
- 6 : WriteAT(LeftTab+Tab,LineOne+1,F,B, ' WriteCenter ');
- 7 : WriteAT(LeftTab+2*Tab,LineOne+1,F,B, ' WriteBetween ');
- 8 : WriteAT(LeftTab+3*Tab,LineOne+1,F,B, ' WriteVert ');
- 9 : WriteAT(LeftTab,Lineone+2,F,B, ' TempMessage ');
- 10: WriteAt(LeftTab+tab,LineOne+2,F,B, ' FindCursor ');
- 11: WriteAt(LeftTab+2*tab,LineOne+2,F,B, ' PosCursor ');
- 12: WriteAt(LeftTab+3*Tab,LineOne+2,F,B, ' SizeCursor ');
- 13: WriteAT(LeftTab,Lineone+3,F,B, ' OffCursor ');
- 14: WriteAt(LeftTab+tab,LineOne+3,F,B, ' OnCursor ');
- 15: WriteAt(LeftTab+2*tab,LineOne+3,F,B, ' VideoOff ');
- 16: WriteAt(LeftTab+3*Tab,LineOne+3,F,B, ' VideoOn ');
- end; {case}
- end; {WriteOption}
-
- Procedure Hilite(Pick:integer);
- begin
- WriteOption(Pick,White,red);
- end; {HiLite}
-
- Procedure LoLite(Pick:integer);
- begin
- WriteOption(Pick,Lightgray,C3);
- end; {LoLite}
-
- Procedure DisplayDescription(Pick : integer);
- const
- X = 7;
- Y = 20;
- C = yellow;
- begin
- case Pick of
- 1 : begin
- WriteAT(X,Y,C,black, 'Syntax : Box(X1,Y1,X2,Y2,F,B,boxtype : integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Draws a rectangular box on the screen in foreground color ');
- WriteAT(X,Y+3,C,black,' F and background color B. The boxtype indicates what line ');
- WriteAT(X,Y+4,C,black,' type to use i.e. single, double or combined. ');
- end;
- 2 : begin
- WriteAT(X,Y,C,black, 'Syntax : HorizLine(X1,X2,Y,F,B,LineType:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Draws a horizontal line on the screen in foreground color ');
- WriteAT(X,Y+3,C,black,' F and background color B. The linetype indicates what line');
- WriteAT(X,Y+4,C,black,' type to use i.e. single or double. ');
- end;
- 3 : begin
- WriteAT(X,Y,C,black, 'Syntax : VertLine(X,Y1,Y2,F,B,LineType:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Draws a vertical line on the screen in foreground color F ');
- WriteAT(X,Y+3,C,black,' and background color B. The linetype indicates what line ');
- WriteAT(X,Y+4,C,black,' type to use i.e. single or double. ');
- end;
- 4 : begin
- WriteAT(X,Y,C,black, 'Syntax : WriteAT(X,Y,F,B:integer;ST:string80); ');
- WriteAT(X,Y+2,C,black,'Purpose : Writes the string St very quickly on the screen starting ');
- WriteAT(X,Y+3,C,black,' at (X,Y) in foreground color F and background color B. The');
- WriteAT(X,Y+4,C,black,' string may be concatenated e.g. ''Techno''+''Jock''. ');
- end;
- 5 : begin
- WriteAT(X,Y,C,black, 'Syntax : ClearText(X1,Y1,X2,Y2,F,B:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Clears the characters for a rectangular area on the screen');
- WriteAT(X,Y+3,C,black,' and displays background color B. The attribute for the ');
- WriteAT(X,Y+4,C,black,' foreground is set to F. Unaffected by Window setting. ');
- end;
- 6 : begin
- WriteAT(X,Y,C,black, 'Syntax : WriteCenter(Lineno,F,B:integer;ST:string80); ');
- WriteAT(X,Y+2,C,black,'Purpose : Writes the string ST very quickly on the screen in the ');
- WriteAT(X,Y+3,C,black,' center of line Lineno in foreground color F and back- ');
- WriteAT(X,Y+4,C,black,' ground color B. The string may be concatenated. ');
- end;
- 7 : begin
- WriteAT(X,Y,C,black, 'Syntax : WriteBetween(X1,X2,Y,F,B:integer;ST:string80); ');
- WriteAT(X,Y+2,C,black,'Purpose : Writes the string ST very quickly on the screen centered ');
- WriteAT(X,Y+3,C,black,' between X1 and X2 on line Y, in foreground F and back- ');
- WriteAT(X,Y+4,C,black,' ground color B. The string may be concatenated. ');
- end;
- 8 : begin
- WriteAT(X,Y,C,black, 'Syntax : WriteVert(X,Y,F,B;ST:string80); ');
- WriteAT(X,Y+2,C,black,'Purpose : Writes the string ST vertically on the screen starting at ');
- WriteAT(X,Y+3,C,black,' coordinate (X,Y) and continuing down the screen, in fore- ');
- WriteAT(X,Y+4,C,black,' ground color F and background color B. ');
- end;
- 9 : begin
- WriteAT(X,Y,C,black, 'Syntax : Tempmessage(X,Y,F,B:integer;ST:string80); ');
- WriteAT(X,Y+2,C,black,'Purpose : Displays a message anywhere on the screen in foreground ');
- WriteAT(X,Y+3,C,black,' color F and background color B, and waits for any key to ');
- WriteAT(X,Y+4,C,black,' be pressed. The screen contents are then restored. ');
- end;
- 10: begin
- WriteAT(X,Y,C,black, 'Syntax : FindCursor(var X,Y,ScanTop,ScanBot:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Returns the precise location of the cursor, and the top & ');
- WriteAT(X,Y+3,C,black,' bottom scan lines i.e. the cursor shape. The X and Y ');
- WriteAT(X,Y+4,C,black,' coords are independant of the current Window setting. ');
- end;
- 11: begin
- WriteAT(X,Y,C,black, 'Syntax : PosCursor(X,Y:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Locates the cursor at coordinates (X,Y). This procedure ');
- WriteAT(X,Y+3,C,black,' differs from Turbo Pascals procedure GotoXY, in that it ');
- WriteAT(X,Y+4,C,black,' not affected by the current window setting. ');
- end;
- 12: begin
- WriteAT(X,Y,C,black, 'Syntax : SizeCursor(ScanTop,ScanBot:integer); ');
- WriteAT(X,Y+2,C,black,'Purpose : Changes the shape of the cursor on monochrome and color ');
- WriteAT(X,Y+3,C,black,' systems. The top scan line is 0 and the bottom is either ');
- WriteAT(X,Y+4,C,black,' 13 for monochrome or 7 for color. ');
- end;
- 13: begin
- WriteAT(X,Y,C,black, 'Syntax : Offcursor; ');
- WriteAT(X,Y+2,C,black,'Purpose : Provides a simple way of hiding the cursor on both mono- ');
- WriteAT(X,Y+3,C,black,' chrome and color systems. ');
- WriteAT(X,Y+4,C,black,' ');
- end;
- 14: begin
- WriteAT(X,Y,C,black, 'Syntax : OnCursor; ');
- WriteAT(X,Y+2,C,black,'Purpose : Provides a quick way of resetting the cursor to the ');
- WriteAT(X,Y+3,C,black,' default DOS setting i.e. a thin line beneath the ');
- WriteAT(X,Y+4,C,black,' character. ');
- end;
- 15: begin
- WriteAT(X,Y,C,black, 'Syntax : VideoOff; ');
- WriteAT(X,Y+2,C,black,'Purpose : Switches the video port off to avoid ''snow'' on systems ');
- WriteAT(X,Y+3,C,black,' equipped with an IBM Color Graphics Adapter when writing ');
- WriteAT(X,Y+4,C,black,' direct to screen memory. ');
- end;
- 16: begin
- WriteAT(X,Y,C,black, 'Syntax : VideoOn; ');
- WriteAT(X,Y+2,C,black,'Purpose : Switches the video port on following VideoOff and ');
- WriteAT(X,Y+3,C,black,' refreshes the screen. ');
- WriteAT(X,Y+4,C,black,' ');
- end;
- end; {case}
- end; {DisplayDescription}
-
- Procedure Keystroke;
- var
- Allover : boolean;
- I,CurrentPick : integer;
- begin
- Allover := false;
- CurrentPick := 1;
- For I := 1 to Max_Picks do
- LoLite(I);
- HiLite(CurrentPick);
- Repeat
- Wait_For_Keypress(Ch);
- If upcase(Ch) in [' ',EscKey,Tabkey] then Funckey := true;
- If Funckey = true then
- begin
- Case upcase(Ch) of
- CursorUp : If CurrentPick > 4 then
- begin
- LoLite(CurrentPick);
- CurrentPick := CurrentPick - 4;
- HiLite(CurrentPick);
- end;
- CursorDown : If CurrentPick <= Max_Picks - 4 then
- begin
- LoLite(CurrentPick);
- CurrentPick := CurrentPick + 4;
- HiLite(CurrentPick);
- end;
- ' ',
- Tabkey,
- CursorRight : begin
- LoLite(CurrentPick);
- If CurrentPick < Max_Picks then
- CurrentPick := CurrentPick + 1
- else
- CurrentPick := 1;
- HiLite(CurrentPick);
- end;
- CursorLeft : begin
- LoLite(CurrentPick);
- If CurrentPick > 1 then
- CurrentPick := CurrentPick - 1
- else
- CurrentPick := Max_Picks;
- HiLite(CurrentPick);
- end;
- EscKey,
- EndKey : Allover := true;
- end; {case}
- DisplayDescription(CurrentPick);
- end; {if true}
- Until Allover;
- end; {Keystroke}
-
-
- begin {Explain_Fastwrite}
- SaveScreen(1);
- Clrscr;
- OffCursor;
- MainText;
- DisplayDescription(1);
- Keystroke;
- RestoreScreen(1);
- DisposeScreen(1);
- end; {proc Explain_Fastwrite}
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 3 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Explain_Windows;
- var I : integer;
- begin
- Savescreen(1);
- OffCursor;
- MkWin(1,1,35,14,yellow,green,2);
- WriteBetween(1,35,3,yellow,green,'Window.TTT');
- WriteAt(3,5,white,green,'The Window procedures provide');
- WriteAT(3,6,white,green,'tools for easily writing flash');
- WriteAT(3,7,white,green,'up window routines. ');
- WriteAT(3,10,white,green,'They also include procedures');
- WriteAT(3,11,white,green,'for saving and restoring screen');
- WriteAT(3,12,white,green,'images.');
- Delay(4000);
- Mkwin(34,7,66,20,lightgray,red,3);
- WriteAT(36,9,white,red, 'The windows can be placed any');
- WriteAT(36,10,white,red,'where on the screen and both');
- WriteAT(36,11,white,red,'the border style and colors ');
- WriteAT(36,12,white,red,'can be easily altered.');
- Delay(3000);
- Mkwin(20,13,68,25,lightblue,magenta,1);
- WriteAT(22,15,white,magenta,'There are five procedures in the Windows Kit.');
- WriteAT(22,16,white,magenta,'The two window procedures are simply MkWin to');
- WriteAT(22,17,white,magenta,'create a window, and RmWin to remove a window');
- WriteAT(22,19,white,magenta,'The remaining three procedures are SaveScreen');
- WriteAT(22,20,white,magenta,'RestoreScreen and DisposeScreen. As the names');
- WriteAT(22,21,white,magenta,'suggest these procedures control the saving &');
- WriteAT(22,22,white,magenta,'restoring of screens. ');
- WriteAT(22,24,white,magenta,'Press any key to see a fast screen restore!');
- Savescreen(2);
- Wait_for_Keypress(Ch);
- RestoreScreen(1);
- Delay(700);
- RestoreScreen(2);
- For I := 1 to 12 do
- begin
- RestoreScreen(1);
- Delay(150);
- RestoreScreen(2);
- Delay(150);
- end;
- Mkwin(1,21,80,25,white,red,0);
- WriteCenter(23,white,red,'Phew. That included a 150th of a second delay so you could see it!');
- WriteAt(60,25,white,red,'press any key .... ');
- DisposeScreen(1);
- DisposeScreen(2);
- Wait_for_Keypress(Ch);
- Rmwin;
- Delay(200);
- Rmwin;
- Delay(200);
- Rmwin;
- Delay(200);
- Rmwin;
- Mkwin(20,10,60,15,white,red,2);
- WriteAt(25,12,white,red,'End of the Windows Demonstration');
- WriteAt(25,13,white,red,'You are now back at the menu!');
- Delay(3000);
- RmWin;
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 4 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Explain_Menu;
- var P,code : integer;
- Procedure Instructions(Number:integer);
- begin
- P := 1;
- Case Number of
- 1 : begin
- WriteAT(9,23,white,black,
- 'This is a mock up of the Main menu but changed to two picks per line,');
- WriteAT(9,24,white,black,
- 'and moved to the left. Play with the cursor and select an option. ');
- end;
- 2 : begin
- WriteAT(9,23,white,black,
- 'Now the menu has been changed back to one pick per line and the ');
- WriteAT(9,24,white,black,
- 'prefix has changed to a letter. Press a letter or move & Enter. ');
- end;
- 3 : begin
- WriteAT(9,23,white,black,
- 'Last one I promise! Now the prefix is a number and we''ve changed ');
- WriteAT(9,24,white,black,
- 'the colors. Select an option and press Enter. ');
- end;
- end; {case}
- end; {sub proc Instructions}
- begin
- Savescreen(1);
- Clrscr;
- OffCursor;
- Box(1,1,80,25,lightred,black,1);
- WriteCenter(3,lightred,black,'Menu.TTT');
- WriteAT(3,5,white,black,
- 'The Menu kit is one of the most powerful and easy to use tools in the whole');
- WriteAT(3,6,white,black,
- 'Toolkit. Menuing routines are always a chore and seem to be something we all');
- WriteAT(3,7,white,black,
- 'leave to the end of the development. BUT a friendly and consistent interface');
- WriteAT(3,8,white,black,
- 'is fundamental to the acceptance of a program. Menu.TTT is a must.');
- WriteAT(3,10,white,black,
- 'The main menu of this demo program is constructed using the kit. All you have');
- WriteAT(3,11,white,black,
- 'to do is define a menu record and call the procedure DisplayMenu -- thats ');
- WriteAT(3,12,white,black,
- 'right, there is only one procedure.');
- WriteAT(3,14,white,black,
- 'In the menu record you detail the following : a heading, the number of picks,');
- WriteAT(3,15,white,black,
- 'the menu text for each pick, the number of picks on a line (typically 1), ');
- WriteAT(3,16,white,black,
- 'the box location and the desired colors, you also indicate whether the Esc ');
- WriteAT(3,17,white,black,
- 'key is enabled. That is all there is to it.');
- WriteAT(3,19,white,black,
- 'The menu procedure includes extensive error checking and wherever possible ');
- WriteAT(3,20,white,black,
- 'if an invalid value is found the system will correct. For example if the box ');
- WriteAT(3,21,white,black,
- 'will not fit on the screen the procedure will shift it so that it does fit. ');
- WriteAt(3,23,lightred,black,
- 'To illustrate how easy it is to modify and change menus, lets display the ');
- WriteAt(3,24,lightred,black,
- 'main menu a few different ways by simply changing the menu record. ');
- WriteAt(60,25,lightred,black,' press any key .... ');
- Wait_for_Keypress(Ch);
- Clrscr;
- Offcursor;
- Box(1,22,80,25,lightred,black,1);
- With M1 do
- begin
- PicksPerLine := 2;
- TopleftXY[1] := 1;
- end;
- Instructions(1);
- Displaymenu(M1,false,P,code);
- With M1 do
- begin
- PicksPerLine := 1;
- TopleftXY[1] := 55;
- TopleftXY[2] := 6;
- Addprefix := 2;
- end;
- Instructions(2);
- Displaymenu(M1,false,P,code);
- With M1 do
- begin
- TopleftXY[1] := 10;
- TopleftXY[2] := 9;
- Addprefix := 1;
- Colors[1] := yellow;
- Colors[2] := green;
- Colors[3] := lightgreen;
- Colors[4] := black;
- Colors[5] := white;
- end;
- Instructions(3);
- Displaymenu(M1,false,P,code);
- Mkwin(5,10,70,17,white,red,2);
- Offcursor;
- WriteAT(15,12,white,red,'All these modifications were effected by making');
- WriteAT(15,13,white,red,'simple changes to the menu record. ');
- WriteAT(15,15,white,red,'Thats all, lets return to the real menu. ');
- WriteAT(50,17,white,red,' press any key .... ');
- Define_Menu1; {set it all back to normal}
- Wait_for_Keypress(Ch);
- Rmwin;
- RestoreScreen(1);
- DisposeScreen(1);
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 5 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Help_EditKeys;
- begin
- Mkwin(40,1,80,25,lightcyan,blue,2);
- WriteBetween(40,80,2,lightcyan,blue,'IO Editing Keys');
- WriteAT(42,3,white,blue,'The operative edit keys are defined');
- WriteAT(42,4,white,blue,'in DECL.TTT. They may be modified to');
- WriteAT(42,5,white,blue,'suit your needs. The defaults are: ');
- WriteAT(42,7,white,blue, 'Move Up '+chr(024));
- WriteAT(42,8,white,blue, 'Move Down '+chr(025));
- WriteAT(42,9,white,blue,'Move Right Ctrl -'+chr(016)+', Tab or Enter');
- WriteAT(42,10,white,blue,'Move Left Ctrl '+chr(017)+'- or ShiftTab');
- WriteAT(42,12,white,blue,'Insert Press [Ins] to toggle');
- WriteAT(42,14,white,blue,'Del Char [Del] or [Backspace]');
- WriteAT(42,15,white,blue,'Del Field Alt-D');
- WriteAT(42,16,white,blue,'Del Global Alt-E');
- WriteAT(42,18,white,blue,'Update [End]');
- WriteAT(42,19,white,blue,'Abort [Esc]');
- WriteAT(42,21,white,blue,'Note the abort key can be disabled,');
- WriteAT(42,22,white,blue,'as it is in this example. Just press');
- WriteAT(42,23,white,blue,'[End] to finish the example.');
- Wait_For_Keypress(Ch);
- Rmwin;
- end;
-
- Procedure Explain_IO;
- Procedure Display_Text;
- begin
-
- Clrscr;
- Box(1,1,80,11,yellow,black,3);
- WriteCenter(2,yellow,black,'IO.TTT');
- WriteAT(3,4,lightgreen,black,
- 'One of the (few) short comings of Turbo Pascal is its very limited support');
- WriteAT(3,5,lightgreen,black,
- 'for screen input that gives the user a chance to move around the screen and');
- WriteAT(3,6,lightgreen,black,
- 'and edit the input. Thats why I developed the IO kit.');
- WriteAT(3,8,lightgreen,black,
- 'These IO procedures allow you to display input fields with format controls');
- WriteAT(3,9,lightgreen,black,
- 'e.g. all capitals or only numbers. There are many features to the Kit. The');
- WriteAT(3,10,lightgreen,black,
- 'example below illustrates some of the power of this easy to use Kit.');
- end;
-
- Procedure IO_Example;
- var
- s1,s2,s3,s4,s5,s6:string80;
- retcode : integer;
- begin
- Box(3,13,78,25,white,black,1);
- Horizline(4,77,15,white,black,1);
- Textcolor(white);
- GotoXY(3,15);write(chr(195));
- GotoXY(78,15);write(chr(180));
- Textcolor(lightred);
- GotoXY(20,14);write(chr(004));
- GotoXY(57,14);write(chr(004));
- GotoXY(22,14);write(chr(004));
- GotoXY(59,14);write(chr(004));
- Textcolor(yellow);
- GotoXY(21,14);write(chr(004));
- GotoXY(58,14);write(chr(004));
- Offcursor;
- WriteCenter(14,Lightblue,black,'Technojocks Inventory Control');
- WriteAt(22,17,white,black,'Catalogue/Part Number');
- WriteAT(10,19,white,black,'Description');
- WriteAT(10,21,white,black,'Quantity');
- WriteAT(50,21,white,black,'Units');
- WriteAT(10,23,white,black,'Shelf');
- WriteAT(50,23,white,black,'Bin No.');
- WriteAT(66,16,lightred,black,'F1 for HELP');
- S1 := '';
- S2 := '';
- S3 := '';
- S4 := '';
- S5 := '';
- S6 := '0001';
- IO_Setfields(6);
- IO_Soundbeeper(false);
- IO_Allowesc(true);
- IO_HelpProc(ofs(Help_Editkeys));
- IO_Setcolors(white,lightgray,blue,lightgray,red,lightgray);
- IO_DefineStr(1, 6,2,6,2, 45,17, S1,'(####-###)/ ##');
- IO_DefineStr(2, 1,3,1,3, 23,19, S2,replicate(50,'*'));
- IO_DefineSTR(3, 2,4,2,4, 23,21, S3,'#####');
- IO_DefineStr(4, 3,5,3,5, 60,21, S4,'!!!!!!!!!!!!!');
- IO_DefineStr(5, 4,6,4,6, 23,23, S5,'@@ / @');
- IO_DefineStr(6, 5,1,5,1, 60,23, S6,'####');
- IO_DefineMsg(1, 13,25, 'Enter the TTT catalogue number (letters not accepted)');
- IO_DefineMsg(2, 15,25, 'Enter the item description from the Purchase Order');
- IO_DefineMsg(4, 25,25, '(note: Units converted to capitals)');
- IO_DefineMsg(5, 20,25, 'Only letters and punctuation chars allowed');
- IO_DefineMsg(6, 20,25, 'Check details and press [End] to update');
- OnCursor;
- IO_Edit(Retcode);
- OffCursor;
- IO_ResetFields;
- end;
- begin
- SaveScreen(1);
- Display_Text;
- IO_Example;
- RestoreScreen(1);
- DisposeScreen(1);
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 6 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Explain_Misc;
- begin
- Savescreen(1);
- Mkwin(1,1,80,21,yellow,black,1);
- OffCursor;
- WriteCenter(2,yellow,black,'Misc.TTT');
- WriteAT(7,3,lightgreen,black,
- 'This Kit simply contains a pot pourri of miscellaneous procedures and');
- WriteAT(7,4,lightgreen,black,
- 'functions. Some of them are used by the Menu and IO Kits but most are');
- WriteAT(7,5,lightgreen,black,
- 'standalone tools. I have kept this file small to minimize the compile');
- WriteAT(7,6,lightgreen,black,
- 'time of the ToolKit. However, this file could be supplemented with ');
- WriteAT(7,7,lightgreen,black,
- 'your own bag of tricks.');
- WriteAT(7,9,lightgreen,black,
- 'At the time of going to the press, this Kit included the following:');
- WriteAT(7,11,yellow,black,
- 'Date, Time');
- WriteAT(7,12,yellow,black,
- 'Printer_Ready');
- WriteAT(7,13,yellow,black,
- 'Print_Screen');
- WriteAT(7,14,yellow,black,
- 'Flush_Key_Buffer');
- WriteAT(7,15,yellow,black,
- 'MemAvail_in_Bytes');
- WriteAT(7,16,yellow,black,
- 'Replicate');
- WriteAT(7,17,yellow,black,
- 'Wait_for_Keypress');
- WriteAT(7,18,yellow,black,
- 'Beep');
- WriteAT(7,19,yellow,black,
- 'Str_to_Int, Int_to_Str, Real_to_Str');
- WriteAt(30,11,lightgreen,black,
- 'Return the date or time nicely formatted');
- WriteAt(30,12,lightgreen,black,
- 'Return true if the printer is available ');
- WriteAt(30,13,lightgreen,black,
- 'Prints screen, same as pressing PrtSc');
- WriteAt(30,14,lightgreen,black,
- 'Clears the keyboard buffer completely');
- WriteAt(30,15,lightgreen,black,
- 'Returns the heap space available');
- WriteAt(30,16,lightgreen,black,
- 'Returns string with a char repeated');
- WriteAt(30,17,lightgreen,black,
- 'Pauses for key stroke and returns key');
- WriteAt(30,18,lightgreen,black,
- 'An annoying Beep');
- WriteAT(47,19,lightgreen,black,'String and number conversions');
- Wait_for_KeyPress(Ch);
- RestoreScreen(1);
- DisposeScreen(1);
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 7 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Printout;
- begin
- Mkwin(10,8,70,18,white,red,1);
- Offcursor;
- WriteAT(15,10,white,red,'The documentation is contained in file Manual.TTT');
- WriteAT(15,11,white,red,'and it contains no formatting characters. The page');
- WriteAT(15,12,white,red,'length is set to 66 and all lines are less than 80');
- WriteAT(15,13,white,red,'characaters long.');
- WriteAT(15,15,white,red,'At the DOS prompt type Print Manual.TTT , be warned');
- WriteAT(15,16,white,red,'the documentation is good but it''s more than 50 pages.');
- WriteAT(50,18,white,red,' press any key .... ');
- Wait_for_Keypress(Ch);
- Rmwin;
- end;
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- { O P T I O N 8 }
- {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
- Procedure Help;
- const
- X1 = 40;
- Y1 = 5;
- X2 = 80;
- Y2 = 25;
- C1 = lightgray;
- C2 = blue;
- C3 = white;
- C4 = lightcyan;
- begin
- Mkwin(X1,Y1,X2,Y2,C1,C2,3);
- Offcursor;
- WriteBetween(X1,X2,Y1+1,C3,C2,'Help');
- WriteAT(X1+4,Y1+3,C4,C2,'This system gives you a whirl');
- WriteAT(X1+4,Y1+4,C4,C2,'wind tour of Technojocks Turbo ');
- WriteAT(X1+4,Y1+5,C4,C2,'Toolkit. Simply highlight the ');
- WriteAT(X1+4,Y1+6,C4,C2,'topic of interest and press Enter');
- WriteAT(X1+4,Y1+7,C4,C2,'or press the number prefix,or ');
- WriteAT(X1+4,Y1+8,C4,C2,'press the function key. ');
- WriteAT(X1+4,Y1+10,C4,C2,'This whole demo program was built');
- WriteAT(X1+4,Y1+11,C4,C2,'using the toolkit. If you like it');
- WriteAT(X1+4,Y1+12,C4,C2,'let me know.');
- WriteAT(X2-18,Y1+13,C4,C2,'Bob Ainsbury');
- WriteAT(X2-18,Y1+15,C4,C2,'P.O. Box 2197');
- WriteAT(X2-18,Y1+14,C4,C2,'Technojock');
- WriteAT(X2-18,Y1+16,C4,C2,'Houston TX 77252');
- WriteAT(X2-18,Y1+17,C4,C2,'(713) 293-2760');
- WriteBetween(X1,X2,Y2-1,C3,C2,'press any key ...');
- Wait_for_Keypress(Ch);
- RmWin;
- end;
-
- Procedure Initialize;
- begin
- Clrscr;
- Box(25,1,55,5,white,black,1);
- WriteBetween(25,55,3,lightgray,black,'Technojocks Turbo Toolkit');
- WriteBetween(25,55,4,lightgray,black,'V3.0');
- WriteCenter(7,white,black,'"In the software business since Tuesday"');
- WriteAT(19,10,white,black,'This is a program that demonstrates the power of');
- WriteAT(19,11,white,black,'Technojocks Turbo Toolkit. Remember, the toolkit');
- WriteAT(19,12,white,black,'is for IBM compatibles. The toolkit is for both');
- WriteAt(19,13,white,black,'monochrome and color systems BUT this demo is');
- WriteAt(19,14,white,black,'full of dazzling color - sorry monochromers you');
- WriteAt(19,15,white,black,'will have to use your imagination!');
- WriteAt(19,17,white,black,'Bitches, gripes, thanks, kisses, donations to:');
- WriteAt(30,19,white,black,'Bob Ainsbury');
- WriteAt(30,20,white,black,'Technojock');
- WriteAt(30,21,white,black,'P.O. Box 2197');
- WriteAT(30,22,white,black,'Houston, TX 77252');
- WriteAT(5,25,white,black,'Does this machine suffer from snow ? (Y/N) [answer N if unsure]');
- GotoXy(70,25);
- Wait_For_Keypress(Ch);
- If upcase(Ch) = 'Y' then snow := true;
- Clrscr;
- OffCursor;
- Box(25,22,55,25,lightgray,black,1);
- WriteBetween(25,55,23,lightgray,black,'Technojocks Turbo Toolkit');
- WriteBetween(25,55,24,lightgray,black,'V3.0');
- Main_Choice := 1;
- Define_Menu1;
- end;
-
- Procedure Finish;
- begin
- ClrScr;
- OnCursor;
- write('TechnoJocks Turbo Toolkit');
- Halt;
- end;
-
- begin {main program}
- Initialize;
- repeat
- DisplayMenu(M1,false,Main_choice,Error);
- Case Main_Choice of
- 1 :Toolkit_Explained;
- 2 :Explain_Fastwrite;
- 3 :Explain_Windows;
- 4 :Explain_Menu;
- 5 :Explain_IO;
- 6 :Explain_Misc;
- 7 :PrintOut;
- 8 :Help;
- 9 :Finish;
- end; {case}
- until true = false; {a very very very long time !}
- end.
-