!SHORT:Attrib Change display color for part or all of screen Attrib WinTTT Purpose To change the display color (attribute) for part or all of the screen. Declaration Attrib(X1,Y1,X2,Y2,F,B:integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) F is the foreground color (0..15) B is the background color (0..15) Uses Crt, FastTTT, DOS, WinTTT. Remarks The characters themselves are not changed, only their display color. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN ATTRIB(1,13,80,35,LIGHTGRAY,BLACK); END. The lower half of the screen display is changed to light gray characters on a black background. !SEEALSO:Fastttt.ngo:ClearText !SHORT:CopyScreenBlock Copy one part of screen to another area CopyScreenBlock WinTTT Purpose To copy one part of the screen to another area of the display. Declaration CopyScreenBlock(X1,Y1,X2,Y2,X,Y:integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) X is the top left X coord of the target location (1..80) Y is the top left Y coord of the target location (1..25) Uses Crt, FastTTT, DOS, WinTTT. Remarks The data is copied or duplicated to another location on the screen. Use the procedure MoveScreenBlock if you want to physically move the information whilst blanking the source area. The copy operation actually occurs one line at a time, so unexpected results may occur if the source and target zones overlap. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN COPYSCREENBLOCK(1,1,80,2,1,24); END. The top two lines of the screen are copied to the bottom two lines of the screen. !SEEALSO:MoveScreenBlock !SHORT:DisposeScreen Free heap space allocated to store screen image DisposeScreen WinTTT Purpose To free heap space that was allocated to store a screen image. Declaration DisposeScreen(Page: byte); Page is the number of the screen that was saved with save screen. Uses Crt, FastTTT, DOS, WinTTT. Remarks If you have restored a screen using RestoreScreen and you no longer need the saved screen image, call this procedure to trash the saved image and free the heap space for re-use by the program The Toolkit uses the Turbo Pascal procedures Getmem and Freemem. You should not use the conflicting Mark and Release heap management procedures anywhere in your program. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SAVESCREEN(1); .... . . . {SOME OTHER PROCEDURES THAT CHANGE THE SCREEN} .... RESTORESCREEN(1); DISPOSESCREEN(1); END. !SEEALSO:SaveScreen RestoreScreen !SHORT:FillScreen Fill part or all of screen with specific character FillScreen WinTTT Purpose To fill part or all of the screen with a specific character. Declaration FillScreen(X1,Y1,X2,Y2,F,B:integer; C:char); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) F is the foreground color (0..15) B is the background color (0..15) C is the character (any displayable ASCII character) Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure provides a very fast way of filling the screen with a specific character. It is useful for creating interesting backgrounds for menus and the like. Use the procedure ClearText to clear a portion of the screen. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN FILLSCREEN(1,1,80,25,CYAN,BLACK,CHR(177); END. The whole screen is filled with the ASCII character 177. It gives a blocked stipple effect. See the MenuDem.pas program on the distribution disk for a visual example. !SEEALSO:Fastttt.ngo:ClearText !SHORT:FindCursor Return the location and size of cursor FindCursor WinTTT Purpose To return the location and size of the cursor. Declaration FindCursor(var X,Y,ScanTop,ScanBot: byte); X is the X coord of the cursor (1..80) Y is the Y coord of the cursor (1..25) Scantop is the top scan line of the cursor ScanBot is the bottom scan line of the cursor Uses Crt, FastTTT, DOS, WinTTT. Remarks. This procedure is called by many of the screen saving procedures. The four parameters must be variables, and they are returned with the cursor details. The scan codes refer to the actual location of the top and bottom of the cursor within a character field, where zero is the top of the field (such as the top stroke of the letter T -- got it?), and either 13 or 7 is the bottom of the field on monochrome or color machines respectively. Example USES CRT, FASTTTT, DOS, WINTTT VAR ROW,COL,TOP,BOT: BYTE; BEGIN FINDCURSOR(COL,ROW,TOP,BOT); END. !SEEALSO:SizeCursor OnCursor OffCursor HalfCursor FullCursor !SHORT:FullCursor Change the text cursor to a full block FullCursor WinTTT Purpose To change the text cursor to a full block. Declaration FullCursor; Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure automatically sets the cursor on monochrome and color systems. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN FULLCURSOR; END. !SEEALSO:SizeCursor HalfCursor Oncursor Offcursor !SHORT:GrowMkWin Exploding text window and saves overlayed contents GrowMkWin WinTTT Purpose To create a text window on the screen and saves the screen contents that has been overlayed. This procedure is the functional equivalent of MkWin, except that the window box explodes onto the screen. Declaration GrowMkWin(X1,Y1,X2,Y2,F,B,Boxtype: integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) F is the foreground color (0..15) B is the background color (0..15) BoxType is the window box line type (see remarks) Uses Crt, FastTTT, DOS, WinTTT. Remarks The specifications are the same as for GrowFBox. The normal values for the Boxtype are: 1 Single line 2 Double line 3 Single top/bottom, double sides 4 Double top/bottom, single sides If a BoxType of 0 is passed, the procedure will use a space (' ') as the box character. If any other number (i.e. 5..256) is used, the box is drawn using the ascii character represented by the number. Refer to page 568 of the Turbo Pascal Owner's Handbook to see the ascii table. If the box grows too quickly or too slowly, alter the global variable Speed. The default value is 200; increase the value to slow the speed down, or decrease it to speed the box up. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SPEED := 400; GROWMKWIN(1,1,80,12,WHITE,RED,1); END. !SEEALSO:Mkwin RmWin !SHORT:HalfCursor Make text cursor into a half block HalfCursor WinTTT Purpose To make the text cursor into a half block. Declaration HalfCursor; Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure automatically sets the cursor on monochrome and color systems. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN HALFCURSOR; END. !SEEALSO:SizeCursor FullCursor Oncursor Offcursor !SHORT:MkWin Creat text window and save overlayed screen contents MkWin WinTTT Purpose To create a text window on the screen and save the screen contents that has been overlayed. Declaration MkWin(X1,Y1,X2,Y2,F,B,Boxtype: integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) F is the foreground color (0..15) B is the background color (0..15) BoxType is the window box line type (see remarks) Uses Crt, FastTTT, DOS, WinTTT. Remarks The specifications are the same as for FBox. The normal values for the Boxtype are: 1 Single line 2 Double line 3 Single top/bottom, double sides 4 Double top/bottom, single sides If a BoxType of 0 is passed, the procedure will use a space (' ') as the box character. If any other number (i.e. 5..256) is used the box is drawn using the ascii character represented by the number. Refer to page 568 of the Turbo Pascal Owner's Handbook to see the ascii table. If the box grows too quickly or too slowly, alter the global variable Speed. The default value is 200; increase the value to slow the speed down, or decrease it to speed the box up. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SPEED := 400; MKWIN(1,1,80,12,WHITE,RED,1); END. !SEEALSO:GrowMkWin RmWin !SHORT:MoveScreenBlock Move part of screen to another area of display MoveScreenBlock WinTTT Purpose To move one part of the screen to another area of the display. Declaration MoveScreenBlock(X1,Y1,X2,Y2,X,Y:integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) X is the top left X coord of the target location (1..80) Y is the top left Y coord of the target location (1..25) Uses Crt, FastTTT, DOS, WinTTT. Remarks The data is moved to another location on the screen and the original source area is blanked out. Use CopyScreenBlock to leave the source area in tact. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN COPYSCREENBLOCK(1,1,40,25,41,1); END. The left half of the screen is moved over to the right side. !SEEALSO:CopyScreenBlock !SHORT:OffCursor Make text cursor disappear OffCursor WinTTT Purpose To make the text cursor disappear. Declaration OffCursor; Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure automatically hides the cursor on monochrome and color systems. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN OFFCURSOR; END. !SEEALSO:SizeCursor HalfCursor Oncursor Fullcursor !SHORT:OnCursor Make the text cursor appear in normal DOS Shape OnCursor WinTTT Purpose To make the text cursor appear in the normal DOS shape. Declaration OnCursor; Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure automatically displays the cursor on monochrome and color systems. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN ONCURSOR; END. !SEEALSO:SizeCursor HalfCursor Offcursor Fullcursor !SHORT:PartRestore Transfer data from a variable to screen location PartRestore WinTTT Purpose To transfer data from a variable to a screen location. Declaration PartRestore(X1,Y1,X2,Y2: byte;var Source); Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure is used internally by the Toolkit. !SEEALSO:PartRestoreScreen RestoreScreen PartSave !SHORT:PartRestoreScreen Restore a portion of saved screen PartRestoreScreen WinTTT Purpose To restore a portion of a saved screen to the display. Declaration PartRestoreScreen(Page,X1,Y1,X2,Y2,X,Y: integer); Page is the number of the saved screen X1 is the top left X coord of saved screen (1..80) Y1 is the top left Y coord of saved screen (1..25) X2 is the lower X coord of saved screen (1..80) Y2 is the lower Y coord of saved screen (1..25) X is the top left X coord of the target location (1..80) Y is the top left Y coord of the target location (1..25) Uses CRT, FastTTT, DOS, WinTTT. Remarks The procedure is used to restore part of a screen that was previously saved with SaveScreen. The first four coord. parameters indicate which part of the saved screen should be restored, and the last pair of coords indicate the position on the screen where the top left corner of the restored data is located. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SAVESCREEN(1); ..... .. {SCREEN MODIFYING PROCEDURES} ..... PARTRESTORESCREEN(1,1,1,80,12,1,13); DISPOSESCREEN(1); END. In this example, the screen is saved (let's assume there was something meaningful on the screen at that point), then some other procedures modify the screen display. The top half of the saved screen is then restored to the lower half of the screen display. !SHORT:PartSave Transfer data from screen to a variable PartSave WinTTT Purpose To transfer data from the screen to a variable. Declaration PartSave(X1,Y1,X2,Y2: byte;var Dest); Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure is used internally by the Toolkit. !SEEALSO:SaveScreen !SHORT:RestoreScreen Restore previously saved screen RestoreScreen WinTTT Purpose To restore a previously saved screen. Declaration RestoreScreen(Page: byte); Page is the number of the previously saved screen Uses Crt, FastTTT, DOS, WinTTT. Remarks Only use a page number of a screen that was specified with a previous SaveScreen, otherwise unpredictable results will occur e.g. flashing happy faces. RestoreScreen will return the cursor to the position it was at immediately prior to the corresponding SaveScreen. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SAVESCREEN(1); ..... .. {SCREEN MODIFYING PROCEDURES} ..... RESTORESCREEN(1); DISPOSESCREEN(1); END. !SEEALSO:SaveScreen DisposeScreen SlideRestoreScreen !SHORT:RmWin Remove window and restore original screen contents RmWin WinTTT Purpose To remove a window and restore the original screen contents. Declaration RmWin; Uses Crt, FastTTT, DOS, WinTTT. Remarks The RmWin procedure removes the last displayed window. Successive RmWin statements will remove the earlier displayed windows. If RmWin is called when there are no windows, the procedure simplr returns i.e. no problem. The windows are always removed in reverse order e.g. you cannot create 3 windows in succession and then try to remove the second window without first removing the third one. Example USES CRT, FASTTTT, DOS, WINTTT; VAR CH : CHAR; BEGIN MKWIN(25,20,65,25,WHITE,RED,1); WRITEBETWEEN(25,65,23,WHITE,RED,'DO YOU WANT TO EXIT (Y/N)?'); CH := GETKEY; IF UPCASE(CH) = 'Y' THEN HALT ELSE RMWIN; END. The above program paints a red window with a white single line border on the last five lines of the screen, and displays a message in the center of the box. If the user responds Y then the program terminates, otherwise the window is removed and the program continues. !SEEALSO:MkWin !SHORT:SaveScreen Save screen for subsequent restore SaveScreen WinTTT Purpose To save a screen for subsequent restore. Declaration SaveScreen(Page: byte); Page is the number assigned to the saved screen Uses Crt, FastTTT, DOS, WinTTT. Remarks This procedure will save a full copy of the screen and all the attributes i.e. the colors. The location of the cursor is also saved. Multiple screens can be saved (up to Max_Screens, see Interface Declarations at beginning of chapter) at the same time. The Page number assignment can be arbitrary, but it is good practice to save them in ascending order starting from page 1. If a page is already saved to a particular Page and another screen is saved to that same Page, the saved screen will be overwritten. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SAVESCREEN(1); ..... .. {SCREEN MODIFYING PROCEDURES} ..... RESTORESCREEN(1); DISPOSESCREEN(1); END. !SEEALSO:RestoreScreen DisposeScreen SlideRestoreScreen !SHORT:ScrollUp Scroll all or part of screen upward one line ScrollUp WinTTT Purpose To scroll all or part of the screen upward one line. Declaration ScrollUp(X1,Y1,X2,Y2:integer); X1 is the top left X coordinate (1..80) Y1 is the top left Y coordinate (1..25) X2 is the lower X coordinate (1..80) Y2 is the lower Y coordinate (1..25) Uses Crt, FastTTT, DOS, WinTTT. Remarks All the text is moved up one line and the lower line is replaced with with blanks. The characters and their color attributes are scrolled. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SCROLLUP(10,1,70,5); END. !SEEALSO:CopyScreenBlock MoveScreenBlock !SHORT:SizeCursor Change cursor shap/appearance SizeCursor WinTTT Purpose To change the cursor shape/appearance. Declaration SizeCursor(ScanTop,ScanBot: byte); Scantop is the top scan line of the cursor ScanBot is the bottom scan line of the cursor Uses Crt, FastTTT, DOS, WinTTT. Remarks. This procedure is called by OnCursor, OffCursor, HalfCursor and FullCursor, and these other procedures should normally be used in preference to SizeCursor because they automatically accommodate monochrome and color systems. The scan codes refer to the actual location of the top and bottom of the cursor within a character field, where zero is the top of the field (such as the top stroke of the letter T -- got it?), and either 13 or 7 is the bottom of the field on monochrome or color machines respectively. The cursor can be hidden by setting the top scan line to 14 -- see OffCursor. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN IF BASEOFSCREEN = $B800 THEN SIZECURSOR(5,7) ELSE SIZECURSOR(9,13); END. !SEEALSO:FindCursor OnCursor OffCursor HalfCursor FullCursor !SHORT:SlideRestoreScreen Restore previously saved screen SlideRestoreScreen WinTTT Purpose To restore a previously saved screen. This procedure is the functional equivalent of RestoreScreen except that the text s..l...i...d....e.....s onto the screen Declaration SlideRestoreScreen(Page: byte; Way: direction); Page is the number of the previously saved screen Way is the direction to slide i.e. up, down, left or right Uses Crt, FastTTT, DOS, WinTTT. Remarks Only use a page number of a screen that was specified with a previous SaveScreen, otherwise unpredictable results will occur e.g. flashing happy faces. RestoreScreen will return the cursor to the position it was at immediately prior to the corresponding SaveScreen. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN SAVESCREEN(1); ..... .. {SCREEN MODIFYING PROCEDURES} ..... SLIDERESTORESCREEN(1,DOWN); DISPOSESCREEN(1); END. !SEEALSO:SaveScreen DisposeScreen RestoreScreen !SHORT:TempMessage Display message on screen and wait for keypress/mouse TempMessage WinTTT Purpose To display a message anywhere on the screen, wait for a keypress (or mouse activity), and then restore the original screen contents. Declaration TempMessage(X,Y,F,B: integer; St: string); X is the X coord of the first character (1..80) Y is the Y coordinate or display line (1..25) F is the foreground color (0..15) B is the background color (0..15) St is the string or message text Uses Crt, FastTTT, DOS, WinTTT. Remarks The procedure temporarily stores the line of text together with its color attributes. It displays the temporary message, and after a key is pressed (any key, or any mouse activity), the original text and color attributes are restored to the screen. Note that the procedure does not return which key was pressed. This is one of the most popular procedures in the Toolkit and is most useful when the screen is very busy and you want to display an error or warning message without modifying the display. Example USES CRT, FASTTTT, DOS, WINTTT; BEGIN TEMPMESSAGE(1,1,YELLOW,RED,'YOU CANNOT REFORMAT THE NETWORK!'); END.