MULTI-LEVEL VIRTUAL WINDOWS REFERENCE GUIDE Version 7.0a June 10, 1993 Copyright (C) 1993 Eagle Performance Software All Rights Reserved. _______ ____|__ | (tm) --| | |------------------- | ____|__ | Association of | | |_| Shareware |__| o | Professionals -----| | |--------------------- |___|___| MEMBER WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a T A B L E O F C O N T E N T S 1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . 5 Purpose . . . . . . . . . . . . . . . . . . . . . . . 5 Common Parameters . . . . . . . . . . . . . . . . . . 5 Attributes . . . . . . . . . . . . . . . . . . . . . 6 2. PROCEDURES AND FUNCTIONS . . . . . . . . . . . . . . . 7 AccessWindow . . . . . . . . . . . . . . . . . . . . 7 ChangeBorder . . . . . . . . . . . . . . . . . . . . 7 FillB . . . . . . . . . . . . . . . . . . . . . . . . 7 FillC . . . . . . . . . . . . . . . . . . . . . . . . 8 FillW . . . . . . . . . . . . . . . . . . . . . . . . 8 FindB . . . . . . . . . . . . . . . . . . . . . . . . 8 FindRevB . . . . . . . . . . . . . . . . . . . . . . 8 FindRevW . . . . . . . . . . . . . . . . . . . . . . 8 FindW . . . . . . . . . . . . . . . . . . . . . . . . 9 GetLevelIndex . . . . . . . . . . . . . . . . . . . . 9 HeapOK . . . . . . . . . . . . . . . . . . . . . . . 9 HideWindow . . . . . . . . . . . . . . . . . . . . . 9 InitWindow . . . . . . . . . . . . . . . . . . . . . 9 InRangeB . . . . . . . . . . . . . . . . . . . . . . 10 InRangeI . . . . . . . . . . . . . . . . . . . . . . 10 InRangeL . . . . . . . . . . . . . . . . . . . . . . 10 InRangeW . . . . . . . . . . . . . . . . . . . . . . 10 LimitB . . . . . . . . . . . . . . . . . . . . . . . 11 LimitI . . . . . . . . . . . . . . . . . . . . . . . 11 LimitL . . . . . . . . . . . . . . . . . . . . . . . 11 LimitW . . . . . . . . . . . . . . . . . . . . . . . 11 LocateCursor . . . . . . . . . . . . . . . . . . . . 11 MakeWindow . . . . . . . . . . . . . . . . . . . . . 12 MaxB . . . . . . . . . . . . . . . . . . . . . . . . 12 MaxI . . . . . . . . . . . . . . . . . . . . . . . . 12 MaxL . . . . . . . . . . . . . . . . . . . . . . . . 12 MaxW . . . . . . . . . . . . . . . . . . . . . . . . 12 MinB . . . . . . . . . . . . . . . . . . . . . . . . 13 MinI . . . . . . . . . . . . . . . . . . . . . . . . 13 MinL . . . . . . . . . . . . . . . . . . . . . . . . 13 MinW . . . . . . . . . . . . . . . . . . . . . . . . 13 MoveWindow . . . . . . . . . . . . . . . . . . . . . 13 MoveB . . . . . . . . . . . . . . . . . . . . . . . . 14 MoveW . . . . . . . . . . . . . . . . . . . . . . . . 14 RemoveWindow . . . . . . . . . . . . . . . . . . . . 14 RestoreBorder . . . . . . . . . . . . . . . . . . . . 14 RestoreTurboWindow . . . . . . . . . . . . . . . . . 15 SetCursorDefault . . . . . . . . . . . . . . . . . . 15 SetVirtualSize . . . . . . . . . . . . . . . . . . . 15 SetWindowModes . . . . . . . . . . . . . . . . . . . 16 ShiftB . . . . . . . . . . . . . . . . . . . . . . . 16 ShiftW . . . . . . . . . . . . . . . . . . . . . . . 16 ShowWindow . . . . . . . . . . . . . . . . . . . . . 17 SpanB . . . . . . . . . . . . . . . . . . . . . . . . 17 SpanRevB . . . . . . . . . . . . . . . . . . . . . . 17 SpanRevW . . . . . . . . . . . . . . . . . . . . . . 17 2 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a SpanW . . . . . . . . . . . . . . . . . . . . . . . . 18 SwapB . . . . . . . . . . . . . . . . . . . . . . . . 18 SwapBs . . . . . . . . . . . . . . . . . . . . . . . 18 SwapW . . . . . . . . . . . . . . . . . . . . . . . . 18 SwapWs . . . . . . . . . . . . . . . . . . . . . . . 18 TitleWindow . . . . . . . . . . . . . . . . . . . . . 18 VResizeWindow . . . . . . . . . . . . . . . . . . . . 19 VScrollView . . . . . . . . . . . . . . . . . . . . . 19 VUpdateCursor . . . . . . . . . . . . . . . . . . . . 19 VUpdateRows . . . . . . . . . . . . . . . . . . . . . 20 VUpdateTitles . . . . . . . . . . . . . . . . . . . . 20 VUpdateView . . . . . . . . . . . . . . . . . . . . . 20 VUpdateWindow . . . . . . . . . . . . . . . . . . . . 20 VViewRC . . . . . . . . . . . . . . . . . . . . . . . 21 VViewRCrel . . . . . . . . . . . . . . . . . . . . . 21 VZoomWindow . . . . . . . . . . . . . . . . . . . . . 21 WEosC . . . . . . . . . . . . . . . . . . . . . . . . 21 WEosLn . . . . . . . . . . . . . . . . . . . . . . . 22 WEosToRC . . . . . . . . . . . . . . . . . . . . . . 22 WEosR . . . . . . . . . . . . . . . . . . . . . . . . 22 WBrdrH . . . . . . . . . . . . . . . . . . . . . . . 22 WBrdrPart . . . . . . . . . . . . . . . . . . . . . . 23 WBrdrV . . . . . . . . . . . . . . . . . . . . . . . 23 WClrEol . . . . . . . . . . . . . . . . . . . . . . . 23 WClrEos . . . . . . . . . . . . . . . . . . . . . . . 23 WClrField . . . . . . . . . . . . . . . . . . . . . . 24 WClrFieldEos . . . . . . . . . . . . . . . . . . . . 24 WClrLine . . . . . . . . . . . . . . . . . . . . . . 24 WClrScr . . . . . . . . . . . . . . . . . . . . . . . 24 WClrTitle . . . . . . . . . . . . . . . . . . . . . . 25 WDelLine . . . . . . . . . . . . . . . . . . . . . . 25 WGotoEos . . . . . . . . . . . . . . . . . . . . . . 25 WGotoRC . . . . . . . . . . . . . . . . . . . . . . . 25 WInsLine . . . . . . . . . . . . . . . . . . . . . . 26 WLineH . . . . . . . . . . . . . . . . . . . . . . . 26 WLinePart . . . . . . . . . . . . . . . . . . . . . . 26 WLineV . . . . . . . . . . . . . . . . . . . . . . . 27 WriteAndViewPage . . . . . . . . . . . . . . . . . . 27 WriteToCRT . . . . . . . . . . . . . . . . . . . . . 27 WriteToHidden . . . . . . . . . . . . . . . . . . . . 27 WriteToPage . . . . . . . . . . . . . . . . . . . . . 28 WriteToVirtual . . . . . . . . . . . . . . . . . . . 28 WScrollDown . . . . . . . . . . . . . . . . . . . . . 28 WScrollUp . . . . . . . . . . . . . . . . . . . . . . 28 WWhereC . . . . . . . . . . . . . . . . . . . . . . . 29 WWhereR . . . . . . . . . . . . . . . . . . . . . . . 29 WWrite . . . . . . . . . . . . . . . . . . . . . . . 29 WWriteA . . . . . . . . . . . . . . . . . . . . . . . 30 WWriteAC . . . . . . . . . . . . . . . . . . . . . . 30 WWriteC . . . . . . . . . . . . . . . . . . . . . . . 30 WWriteSub . . . . . . . . . . . . . . . . . . . . . . 31 3. DATA STRUCTURE . . . . . . . . . . . . . . . . . . . . 32 Basic Types . . . . . . . . . . . . . . . . . . . . . 32 Typed Constants . . . . . . . . . . . . . . . . . . . 34 3 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a Untyped Constants . . . . . . . . . . . . . . . . . . 35 Global Variables . . . . . . . . . . . . . . . . . . 36 Dynamic Variables . . . . . . . . . . . . . . . . . . 39 APPENDIX A: MEMORY ALLOCATION . . . . . . . . . . . . . . 40 Global Memory . . . . . . . . . . . . . . . . . . . . 40 Dynamic Memory . . . . . . . . . . . . . . . . . . . 40 Code Size . . . . . . . . . . . . . . . . . . . . . . 41 APPENDIX B: ERROR MESSAGES . . . . . . . . . . . . . . . 42 4 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a 1. I N T R O D U C T I O N PURPOSE This document is a technical reference manual describing each routine and variable in detail in a format similar to the BP manual. The routines are described in alphabetical order. Since this manual is on disk, you can find your interest easily with any search utility. Application - Because WNDW uses QWIK, all routines will perform in the following applications: . All video text modes - 0, 1, 2, 3 and 7. . Any column mode - 40, 80, or variable. . For IBM PC, XT, AT, PCjr, PC convertible, all PS/2 models, 3270 PC, and compatibles. . With MDA, CGA, EGA, MCGA, VGA, 8214/A, all Hercules video cards. . Perform routines in both absolute and window-relative coordinates. . Writes direct to high speed multi-tasking video buffers (MTVB). COMMON PARAMETERS Common Parameters - Most procedures use the same parameters. Rather than repeating them for each routine, detailed descriptions for those parameters are listed below. Window Coordinates - Unless otherwise stated, all WNDW routines work in window-relative coordinates. For simplicity, virtual routines check for bounds to keep routines confined to the windows and screen. However, to be fast, some other routines indicated in this document do not check for bounds in the windows or on the screen, so be sure to stay in range. The upper left column in a window is row 1, column 1, which is also called a 1-based coordinate system. Row/Col - Row and Col were chosen in lieu of the X/Y scheme used in TP. Since WNDW is for only text modes, the screen is treated like a word processor with rows and columns. It is more intuitive to use the X/Y scheme in graphics and the Row/Col scheme for text. Rows/Cols - Using Rows/Cols is much easier than Row2/Col2 to describe the height and width of a block such as: MakeWindow (Row,Col,Rows,Cols,Wattr,Battr,Border,Name); Should you decide to move the window, only Row and Col need to be changed, and therefore Rows and Cols don't need to be mentally recalculated and altered. Please keep Cols limited to one row. NumOfRows/NumOfCols - These parameters indicate a relative shift from a given point that can be positive or negative. aStr - The window-relative writing routines like WWrite and WWriteC actually use QWIK to write this string. There is only on line of code for Chapter 1, Introduction Page 5 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a these routines since they just relocate where QWIK is suppose to write in the window. ATTRIBUTES *Attr - Use the convenient attribute constants for the foreground and background colors supplied in the QWIK unit rather than having to use TP functions or procedures to get a desired color, for example: MakeWindow (1,1,8,8,White+BlueBG,Yellow+BlueBG,SingleBrdr,aWindow) will make a window with a white on blue window and yellow on blue border. All subsequent routines will use these attributes for writing. TextAttr is also set to the window attribute in case the Turbo write routines are used. The foreground constants in QWIK are duplicates of those in the CRT unit and are repeated here for convenience: Black = $00; DarkGray = $08; Blue = $01; LightBlue = $09; Green = $02; LightGreen = $0A; Cyan = $03; LightCyan = $0B; Red = $04; LightRed = $0C; Magenta = $05; LightMagenta = $0D; Brown = $06; Yellow = $0E; LightGray = $07; White = $0F; Blink = $80; In addition, the QWIK background color constants were included to take advantage of constant folding. BlackBG = $00; BlueBG = $10; GreenBG = $20; CyanBG = $30; RedBG = $40; MagentaBG = $50; BrownBG = $60; LightGrayBG = $70; SameAttr = -1; SameAttr - A powerful and unique feature of all WNDW routines is the use of the constant SameAttr. If SameAttr, or a negative value, is used as an attribute, the routine will suppress any changes to the attributes and use what is currently on the screen. Chapter 1, Introduction Page 6 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a 2. P R O C E D U R E S A N D F U N C T I O N S In this section, a detailed description is provided for each procedure and function. --------------------------------------------------------------------------- AccessWindow procedure Wndw --------------------------------------------------------------------------- Function Randomly accesses a covered window and places it on the top. If the window is hidden, it uses ShowWindow to put it on top. Declaration AccessWindow (WindowName: WindowNames) Screens All video pages. Remarks All underlays are properly updated in the heap with a high speed technique. If NoAccessMode has been set for this window or an invalid window name is used, the procedure is simply ignored. Virtual windows are updated after being shown. Zoom effect is optional. The WndwStats are shuffled to match the new levels. Restrictions Shadows are fully supported. For human factors, opaque shadows are only recommended for the top window only. EOS Restored to new window. Heap Temporarily uses (underlay size * 1.5). Exit Forced to write to CRT. See also HideWindow, ShowWindow --------------------------------------------------------------------------- ChangeBorder procedure Wndw --------------------------------------------------------------------------- Function Changes the border to a new border style. Declaration ChangeBorder (NewBrdr: Borders) Screens All video pages. Remarks The original border style is already saved in ViewBrdr. The current border is changed by searching for a match of WSbrdr for each border part with the current attribute. If a match is found, it is replaced with NewBrdr. Tees as well as virtual borders are also replaced. The original border can later be restored with RestoreBorder. EOS Restored to CRT. Exit Forced to write to CRT. Restrictions NoBrdr is ignored as either the original or new border. See also RestoreBorder --------------------------------------------------------------------------- FillB procedure Wutil --------------------------------------------------------------------------- Function Fill a block of memory with a repeated character. Declaration FillB (var Dest; NumOfBytes: word; aByte: byte) Remarks Up to twice as fast as System.FillChar. See also FillC, FillW. Chapter 2, Procedures and Functions Page 7 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- FillC procedure Wutil --------------------------------------------------------------------------- Function Fill a block of memory with a repeated character. Declaration FillC (var Dest; NumOfChars: word; aChar: char) Remarks Up to twice as fast as System.FillChar. See also FillB, FillW. --------------------------------------------------------------------------- FillW procedure Wutil --------------------------------------------------------------------------- Function Fill a block of memory with a repeated character. Declaration FillW (var Dest; NumOfWords, aWord: word) Remarks Up to twice as fast as System.FillChar. See also FillB, FillC. --------------------------------------------------------------------------- FindB procedure Wutil --------------------------------------------------------------------------- Function Finds the first match of a byte in memory. Declaration FindB (var aPtr; Find: byte; MaxBytes: word) Result type word Remarks Returns a 1-based result pointing to the position (not offset) of the Find. The variable aPtr points to Byte 1. A zero result means no match was found. Maximum size to search is 64k of bytes. See also FindRevB, FindRevW, FindW --------------------------------------------------------------------------- FindRevB procedure Wutil --------------------------------------------------------------------------- Function Finds the first match of a byte in memory scanning in reverse. Declaration FindRevB (var aPtr; Find: byte; MaxBytes: word) Result type word Remarks Returns a 1-based result pointing to the position (not offset) of the Find. The variable aPtr points to Byte 1. A zero result means no match was found. Maximum size to search is 64k of bytes. See also FindB, FindRevW, FindW --------------------------------------------------------------------------- FindRevW procedure Wutil --------------------------------------------------------------------------- Function Finds the first match of a word in memory scanning in reverse. Declaration FindRevW (var aPtr; Find: word; MaxWords: word) Result type word Remarks Returns a 1-based result pointing to the position (not offset) of the Find. The variable aPtr points to Byte 1. A zero result means no match was found. Maximum size to search is 32k of words. See also FindB, FindRevB, FindW Chapter 2, Procedures and Functions Page 8 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- FindW procedure Wutil --------------------------------------------------------------------------- Function Finds the first match of a word in memory. Declaration FindB (var aPtr; Find: word; MaxWords: word) Result type word Remarks Returns a 1-based result pointing to the position (not offset) of the Find. The variable aPtr points to Byte 1. A zero result means no match was found. Maximum size to search is 32k of words. See also FindRevB, FindRevW, FindB --------------------------------------------------------------------------- GetLevelIndex function Wndw --------------------------------------------------------------------------- Function Returns the WndwStat index given the WindowName. Declaration GetLevelIndex (WindowName: WindowNames) Result type word Remarks This routine scans for the first matching WindowName. It scans from the top level index (LI) first and then down. Hidden windows from the hidden level index (HLI) up are scanned last. If no match is found, the result is >MaxWndw. --------------------------------------------------------------------------- HeapOK function Wndw --------------------------------------------------------------------------- Function Returns TRUE if enough heap is available from MaxAvail. Declaration HeapOK (NumOfBytes: word) Result type boolean Remarks If there is insufficient heap, the program terminates through the GOOF unit. The error window will display MemAvail and MaxAvail. All WNDW procedures that use the heap run this routine. --------------------------------------------------------------------------- HideWindow procedure Wndw --------------------------------------------------------------------------- Function Hides the current top window on the CRT. Declaration HideWindow Screens All video pages. Remarks The window is saved in RAM and the underlay is restored on the screen showing the new top window. If NoHideMode has been set for this window, the procedure is ignored. The windows are saved with the border, but without any shadow. EOS Altered to (Wrow,Wcol) before hiding, then restored to the new top window. Heap Temporarily uses (underlay size * 1.5). Exit Forced to write to CRT. See also ShowWindow --------------------------------------------------------------------------- InitWindow procedure Wndw --------------------------------------------------------------------------- Function Initializes global data for WNDW routines. In brief, it sets the defaults for WndwStat, indexes and margins for each Chapter 2, Procedures and Functions Page 9 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a video page. Declaration InitWindow (Wattr: integer; ClearScr: boolean); Remarks This is the first routine required to executed early in the main program and only needs to be done once. Wattr is the attribute for the full screen (Window0) for all video pages. If ClearScr is true, then all video pages are cleared with Wattr. Over 50 variables are initialized with this procedure. See InitWindow source code for details. EOS Set to (1,1). Heap Allocates VirtualStat and PageStat arrays as required. See also SetCursorDefault, WNDW70A.DOC and Data Structure section. --------------------------------------------------------------------------- InRangeB function Wutil --------------------------------------------------------------------------- Function Returns true if a byte value is in between upper and lower limits inclusive. Declaration InRangeB (Lower,Value,Upper: byte) Result type boolean Remarks High speed evaluation written in assembler. See also InRangeI, InRangeL, InRangeW, Limit* --------------------------------------------------------------------------- InRangeI function Wutil --------------------------------------------------------------------------- Function Returns true if an integer value is in between upper and lower limits inclusive. Declaration InRangeI (Lower,Value,Upper: integer) Result type boolean Remarks High speed evaluation written in assembler. See also InRangeB, InRangeL, InRangeW, Limit* --------------------------------------------------------------------------- InRangeL function Wutil --------------------------------------------------------------------------- Function Returns true if a longint value is in between upper and lower limits inclusive. Declaration InRangeL (Lower,Value,Upper: longint) Result type boolean Remarks High speed evaluation written in assembler. See also InRangeI, InRangeL, InRangeW, Limit* --------------------------------------------------------------------------- InRangeW function Wutil --------------------------------------------------------------------------- Function Returns true if a word value is in between upper and lower limits inclusive. Declaration InRangeW (Lower,Value,Upper: word) Result type boolean Remarks High speed evaluation written in assembler. See also InRangeB, InRangeI, InRangeL, Limit* Chapter 2, Procedures and Functions Page 10 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- LimitB function Wutil --------------------------------------------------------------------------- Function Returns a byte value bounded by upper and lower limits inclusive. Declaration LimitB (Lower,Value,Upper: byte) Result type byte Remarks High speed evaluation written in assembler. See also InRange*, LimitI, LimitL, LimitW --------------------------------------------------------------------------- LimitI function Wutil --------------------------------------------------------------------------- Function Returns an integer value bounded by upper and lower limits inclusive. Declaration LimitI (Lower,Value,Upper: integer) Result type integer Remarks High speed evaluation written in assembler. See also InRange*, LimitB, LimitL, LimitW --------------------------------------------------------------------------- LimitL function Wutil --------------------------------------------------------------------------- Function Returns a longint value bounded by upper and lower limits inclusive. Declaration LimitL (Lower,Value,Upper: longint) Result type longint Remarks High speed evaluation written in assembler. See also InRange*, LimitB, LimitI, LimitW --------------------------------------------------------------------------- LimitW function Wutil --------------------------------------------------------------------------- Function Returns a word value bounded by upper and lower limits inclusive. Declaration LimitW (Lower,Value,Upper: word) Result type word Remarks High speed evaluation written in assembler. See also InRange*, LimitB, LimitI, LimitL --------------------------------------------------------------------------- LocateCursor procedure Wndw --------------------------------------------------------------------------- Function Locates the cursor within the window. Declaration LocateCursor Screens All video pages. Remarks This routine, a subroutine of RestoreTurboWindow, locates the cursor as set in the WndwStat for fixed or virtual windows. It is usually handled automatically, but is available for handling exceptions. VUpdateCursor is a subroutine of LocateCursor. See also RestoreTurboWindow, VUpdateCursor Chapter 2, Procedures and Functions Page 11 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- MakeWindow procedure Wndw --------------------------------------------------------------------------- Function Makes a window. Declaration MakeWindow (Row,Col,Rows,Cols: byte; Wattr,Battr: integer; BrdrSel: Borders; WindowName: WindowNames) Screens All video pages. Remarks This is the main routine to create windows. Row, Col, Row, and Rows is the absolute coordinates for the window inclusive of any border. For RelMode, (Row,Col) is window relative. Wattr and Battr are the window and border attributes, respectively (SameAttr is permitted). BrdrSel is the selection of one of 15 different borders. WindowName is a unique window name required for random access. EOS Set to (1,1). Heap Allocates underlay size until removed. Restrictions Minimum size - (1x1) without borders, (3x3) with borders. See also SetWindowModes, RemoveWindow --------------------------------------------------------------------------- MaxB function Wutil --------------------------------------------------------------------------- Function Returns the maximum value of two bytes. Declaration MaxB (Value1,Value2: byte) Result type byte Remarks High speed evaluation of two bytes. See also MaxI, MaxL, MaxW, MinB, MinI, MinL, MinW --------------------------------------------------------------------------- MaxI function Wutil --------------------------------------------------------------------------- Function Returns the maximum value of two integers. Declaration MaxI (Value1,Value2: integer) Result type integer Remarks High speed evaluation of two integers. See also MaxB, MaxL, MaxW, MinB, MinI, MinL, MinW --------------------------------------------------------------------------- MaxL function Wutil --------------------------------------------------------------------------- Function Returns the maximum value of two long integers. Declaration MaxI (Value1,Value2: longint) Result type longint Remarks High speed evaluation of two long integers. See also MaxB, MaxI, MaxW, MinB, MinI, MinL, MinW --------------------------------------------------------------------------- MaxW function Wutil --------------------------------------------------------------------------- Function Returns the maximum value of two words. Declaration MaxW (Value1,Value2: word) Result type word Remarks High speed evaluation of two words. See also MaxB, MaxI, MaxL, MinB, MinI, MinL, MinW Chapter 2, Procedures and Functions Page 12 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- MinB function Wutil --------------------------------------------------------------------------- Function Returns the minimum value of two bytes. Declaration MinI (Value1,Value2: byte) Result type byte Remarks High speed evaluation of two bytes. See also MaxB, MaxI, MaxL, MaxW, MinI, MinL, MinW --------------------------------------------------------------------------- MinI function Wutil --------------------------------------------------------------------------- Function Returns the minimum value of two integers. Declaration MinI (Value1,Value2: integer) Result type integer Remarks High speed evaluation of two integers. See also MaxB, MaxI, MaxL, MaxW, MinB, MinL, MinW --------------------------------------------------------------------------- MinL function Wutil --------------------------------------------------------------------------- Function Returns the minimum value of two long integers. Declaration MinI (Value1,Value2: longint) Result type longint Remarks High speed evaluation of two long integers. See also MaxB, MaxI, MaxL, MaxW, MinB, MinI, MinW --------------------------------------------------------------------------- MinW function Wutil --------------------------------------------------------------------------- Function Returns the minimum value of two words. Declaration MinW (Value1,Value2: word) Result type word Remarks High speed evaluation of two words. See also MaxB, MaxI, MaxL, MaxW, MinB, MinI, MinL --------------------------------------------------------------------------- MoveWindow procedure Wndw --------------------------------------------------------------------------- Function Moves the current top window on the CRT a relative number of rows and columns. Declaration MoveWindow (NumOfRows,NumOfCols: integer) Screens All video pages. Remarks If NoMoveMode or PermMode has been set for this window, the procedure is ignored. Shadows are fully supported. Margins are respected. EOS Moved relatively to the same place. Heap Maximum requirement is full screen size plus the underlay size. Exit Forced to write to CRT. See also ShowWindow Chapter 2, Procedures and Functions Page 13 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- MoveB procedure Wutil --------------------------------------------------------------------------- Function Copies a specified number of contiguous bytes from a source to a destination in memory. Declaration MoveB (VAR Source,Dest; NumOfBytes: word) Remarks Use 16-bit transfers and does not check for overlap. Faster than ShiftB. Restrictions Source and Dest[0] must not overlap. See also MoveW, ShiftB, ShiftW --------------------------------------------------------------------------- MoveW procedure Wutil --------------------------------------------------------------------------- Function Copies a specified number of contiguous words from a source to a destination in memory. Declaration MoveW (VAR Source,Dest; NumOfWords: word) Remarks Uses 16-bit transfers and does not check for overlap. Faster than ShiftW. Restrictions Source and Dest[0] must not overlap. See also MoveB, ShiftB, ShiftW --------------------------------------------------------------------------- RemoveWindow procedure Wndw --------------------------------------------------------------------------- Function Removes the current top window on the CRT. Declaration RemoveWindow Screens All video pages. Remarks Basically, the top window is removed restoring the underlay and then erased from memory. Depending on the window mode, RemoveWindow responds differently: RelMode - The window-relative stats are simply replaced with the parent window stats. PermMode - The stats are simply dropped from the stack. VirtualMode - The virtual screen is additionally removed from the heap. EOS Restored to the new top window. Heap Deallocates the underlay. Exit Forced to write to CRT. See also MakeWindow --------------------------------------------------------------------------- RestoreBorder procedure Wndw --------------------------------------------------------------------------- Function Restores the border to the original border style. Declaration RestoreBorder Screens All video pages. Remarks Reverses the effect of ChangeBorder by replacing the current border style back to the original. EOS Restored to CRT. Exit Forced to write to CRT. See also ChangeBorder Chapter 2, Procedures and Functions Page 14 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- RestoreTurboWindow procedure Wndw --------------------------------------------------------------------------- Function Restores attributes, cursor, and EOS marker for the current window. Declaration RestoreTurboWindow Screens All video pages. Remarks Usually this procedure is handled automatically. If there is some exception in handling, then this procedure can be used. It does the following: . Resets TextAttr and ScrollAttr to OrigAttr . Restores Turbo window . Reset EOS marker to last saved location . Resets cursor mode . Locates cursor with LocateCursor EOS Restored. See also LocateCursor --------------------------------------------------------------------------- SetCursorDefault procedure Wndw --------------------------------------------------------------------------- Function Sets the default cursor mode to be used by MakeWindow. Declaration SetCursorDefault (CursorMode: word) Remarks This routine simply assigns a value to the global variable CursorDefault. This value is already assigned by InitWindow to the current cursor mode. If a specific cursor mode is required for the initial window as well, use Qwik.SetCursor instead before InitWindow. See also InitWindow, MakeWindow --------------------------------------------------------------------------- SetVirtualSize procedure Wndw --------------------------------------------------------------------------- Function Sets the dimensions for the virtual screen of virtual windows. Declaration SetVirtualSize (Rows,Cols: byte) Remarks This optional procedure sets the rows-by-columns dimensions for a virtual screen. Keep in mind that two additional rows will be internally added for titles if borders are used. The default at startup is the CRT screen size. Restrictions Maximum buffer size is 64k. See also MakeWindow Example Set the size for a virtual screen with 80 columns and a maximum number of rows: SetVirtualSize (253,80); The resulting size would be (253+2)*80*2 = 40,800 bytes which is under 64k. Rows 254 and 255 would be reserved for top and bottom titles on the border. Chapter 2, Procedures and Functions Page 15 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- SetWindowModes procedure Wndw --------------------------------------------------------------------------- Function Sets the window modes to be used by MakeWindow. Declaration SetWindowModes (SumOfAllModes: word) Remarks There are several different modes that can be used: RelMode - Window-relative frame of reference, no underlay PermMode - Can't be moved or removed, no underlay ShadowLeft - Shadow on the left side ShadowRight - Shadow on the right side ShadowTrans - Produces transparent rather than opaque shadows ZoomMode - Zoom effect on Make, Show and AccessWindow HiddenMode - Create window as hidden VirtualMode - Create virtual screen as well CursorOffMode - Leaves cursor off for window SeeThruMode - Doesn't clear area inside window NoHideMode - Ignores request to hide window NoAccessMode - Ignores request to access window NoMoveMode - Ignores request to move/resize window The startup mode is equivalent to zero while the base window is PermMode. The modes should be summed logically, but can also be done arithmetically with care. All PermMode windows must be created first. See also MakeWindow Example Set the modes for the next window to have a right shadow, zoom effect, cursor off, and a virtual screen: SetWindowModes (ShadowRight or ZoomMode or CursorOffMode or VirtualMode); Example Set the modes back to defaults: SetWindowModes (0); --------------------------------------------------------------------------- ShiftB procedure Wutil --------------------------------------------------------------------------- Function Copies a specified number of contiguous bytes from a source to a destination in memory. Declaration ShiftB (VAR Source,Dest; NumOfBytes: word) Remarks Exactly like TP's Move except twice as fast by using 16-bit transfers. Checks for overlap. Use in lieu of Move. See also MoveB, MoveW, ShiftW --------------------------------------------------------------------------- ShiftW procedure Wutil --------------------------------------------------------------------------- Function Copies a specified number of contiguous words from a source to a destination in memory. Declaration ShiftW (VAR Source,Dest; NumOfWords: word) Remarks Uses 16-bit transfers and checks for overlap. See also MoveB, MoveW, ShiftB Chapter 2, Procedures and Functions Page 16 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- ShowWindow procedure Wndw --------------------------------------------------------------------------- Function Shows a hidden window to become the current top window on the CRT. Declaration ShowWindow (WindowName: WindowNames) Screens All video pages. Remarks The underlay is saved from the screen and the window is restored from RAM to become the new top window. Invalid window names are simply ignored. Virtual windows are updated before being shown. Zoom effect is optional. EOS Set to (1,1). Heap Temporarily uses (underlay size * 1.5). Exit Forced to write to CRT. See also HideWindow, AccessWindow --------------------------------------------------------------------------- SpanB procedure Wutil --------------------------------------------------------------------------- Function Returns the number of consecutive bytes in memory. Declaration SpanB (var aPtr; Find: byte; MaxBytes: word) Result type word Remarks Returns a 0-based result of how many identical Finds can be spanned until the first non-match is found. The result can also be used as the offset (not position) from aPtr to the non-match. The variable aPtr points to byte 0. A zero result means no span. Maximum count is the size of one segment or 64k. See also SpanRevB, SpanRevW, SpanW --------------------------------------------------------------------------- SpanRevB procedure Wutil --------------------------------------------------------------------------- Function Returns the number of consecutive bytes in memory scanning in reverse. Declaration SpanRevB (var aPtr; Find: byte; MaxBytes: word) Result type word Remarks Returns a 0-based result of how many identical Finds can be spanned until the first non-match is found. The result can also be used as the offset (not position) from aPtr to the non-match. The variable aPtr points to byte 0. A zero result means no span. Maximum count is the size of one segment or 64k. See also SpanB, SpanRevW, SpanW --------------------------------------------------------------------------- SpanRevW procedure Wutil --------------------------------------------------------------------------- Function Returns the number of consecutive words in memory scanning in reverse. Declaration SpanRevW (var aPtr; Find: byte; MaxWords: word) Result type word Remarks Returns a 0-based result of how many identical Finds can be spanned until the first non-match is found. The result can also be used as the offset (not position) from aPtr to the Chapter 2, Procedures and Functions Page 17 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a non-match. The variable aPtr points to word 0. A zero result means no span. Maximum count is 32k words. See also SpanB, SpanRevB, SpanW --------------------------------------------------------------------------- SpanW procedure Wutil --------------------------------------------------------------------------- Function Returns the number of consecutive words in memory. Declaration SpanB (var aPtr; Find: byte; MaxWords: word) Result type word Remarks Returns a 0-based result of how many identical Finds can be spanned until the first non-match is found. The result can also be used as the offset (not position) from aPtr to the non-match. The variable aPtr points to word 0. A zero result means no span. Maximum count is 32k words. See also SpanRevB, SpanRevW, SpanW --------------------------------------------------------------------------- SwapB procedure Wutil --------------------------------------------------------------------------- Function Swaps a single byte between two locations in memory. Declaration SwapB (var Var1,Var2) Remarks Works best for values in the heap. See also SwapBs, SwapW, SwapWs --------------------------------------------------------------------------- SwapBs procedure Wutil --------------------------------------------------------------------------- Function Swaps a block of bytes between two locations in memory. Declaration SwapBs (var Var1,Var2; NumOfBytes: word) Remarks Swaps the blocks without using temporary memory. See also SwapB, SwapW, SwapWs --------------------------------------------------------------------------- SwapW procedure Wutil --------------------------------------------------------------------------- Function Swaps a single word between two locations in memory. Declaration SwapBs (var Var1,Var2) Remarks Works best for values in the heap. See also SwapB, SwapBs, SwapWs --------------------------------------------------------------------------- SwapWs procedure Wutil --------------------------------------------------------------------------- Function Swaps a block of words between two locations in memory. Declaration SwapWs (var Var1,Var2; NumOfWords: word) Remarks Swaps the blocks without using temporary memory. See also SwapB, SwapBs, SwapW --------------------------------------------------------------------------- TitleWindow procedure Wndw --------------------------------------------------------------------------- Function Places a title on the current window. Declaration TitleWindow (TopOrBottom,Justify: DirType; TitleAttr: integer; Title: string); Chapter 2, Procedures and Functions Page 18 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a Screens All video pages. Remarks There are six positions where the title can be placed in any combination of Top or Bottom, and Left, Center, or Right. TitleAttr is the title attribute (SameAttr is permitted). The titles can be written to hidden windows or virtual screens as well. TitleOfs can be adjusted for justification. EOS Unaltered. See also TitleOfs in Data Structure section. --------------------------------------------------------------------------- VResizeWindow procedure Wndw --------------------------------------------------------------------------- Function Resizes the current top virtual window. Declaration VResizeWindow (NumOfRows,NumOfCols: integer) Remarks The top window is resized by moving the right and/or bottom border. If NoMoveMode or PermMode has been set for this window, the procedure is ignored. Shadows are fully supported. Margins are respected. Heap Maximum requirement is full screen size plus the underlay size. Exit Forced to write to CRT. Restrictions None. See also VZoomWindow --------------------------------------------------------------------------- VScrollView procedure Wndw --------------------------------------------------------------------------- Function Alters the upper left viewing reference point of the current virtual screen by a relative number of rows and columns. The view window is also updated no matter where its location even if hidden or overlapped. Declaration VScrollView (NumOfRows,NumOfCols: integer) Remarks The reference point may be adjusted to keep the viewing window within the virtual window limits. Works in any "WriteTo" mode. Heap If covered, WSrows * Wcols * 5 bytes is temporarily used. Restrictions None. See also VViewRC, VViewRCrel --------------------------------------------------------------------------- VUpdateCursor procedure Wndw --------------------------------------------------------------------------- Function Updates the current virtual window cursor if it is the top window on the CRT. Declaration VUpdateCursor Remarks When the cursor is moved on the virtual screen, the cursor may or may not be seen in the view. This routine updates the location. Works in any "WriteTo" mode. See also VUpdateTitles, VUpdateView, VUpdateWindow Chapter 2, Procedures and Functions Page 19 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- VUpdateRows procedure Wndw --------------------------------------------------------------------------- Function Updates certain rows in the current virtual window view only on the top window. Declaration VUpdateRows (Row,Rows: byte) Remarks This routine is primarily used for fast response for spot updates for data entry or the like where the fastest speed is desirable. If the window is not the top window, the entire view is updated. See also VUpdateView, VUpdateWindow --------------------------------------------------------------------------- VUpdateTitles procedure Wndw --------------------------------------------------------------------------- Function Updates the current virtual window titles. It is also updated no matter where its location even if hidden or overlapped. Declaration VUpdateTitles Remarks This routine updates the titles to the window and truncates them to fit in the current view. Works in any "WriteTo" mode. Heap If covered, WSrows * Wcols * 5 bytes is temporarily used. See also VUpdateCursor, VUpdateView, VUpdateWindow --------------------------------------------------------------------------- VUpdateView procedure Wndw --------------------------------------------------------------------------- Function Updates the current virtual window view. It is also updated no matter where its location even if hidden or overlapped. Declaration VUpdateView Remarks This routine updates the full view of the window. Works in any "WriteTo" mode. Heap If covered, WSrows * Wcols * 5 bytes is temporarily used. See also VUpdateRows, VUpdateTitles, VUpdateWindow --------------------------------------------------------------------------- VUpdateWindow procedure Wndw --------------------------------------------------------------------------- Function Updates the current virtual window including the view, titles and the cursor. It is also updated no matter where its location even if hidden or overlapped. Declaration VUpdateWindow Remarks This is the main routine to update virtual windows. This routine simply executes three procedures: VUpdateCursor, VUpdateView, and VUpdateTitles. Works in any "WriteTo" mode. Restrictions If transparent shadows appear over the window that is being updated, the shadows for the above window will not be updated. Heap If covered, WSrows * Wcols * 5 bytes is temporarily used. See also VUpdateCursor, VUpdateRows, VUpdateTitles, VUpdateView Chapter 2, Procedures and Functions Page 20 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- VViewRC procedure Wndw --------------------------------------------------------------------------- Function Alters the upper left viewing reference point of the current virtual window. Declaration VViewRC (Row,Col: byte) Remarks The reference point may be adjusted to keep the viewing window within the virtual window limits. Works in any "WriteTo" mode. It does not update the viewing window. Restrictions None. See also VViewRCrel, VScrollView --------------------------------------------------------------------------- VViewRCrel procedure Wndw --------------------------------------------------------------------------- Function Alters the upper left viewing reference point of the current virtual window by a relative number of rows and columns. Declaration VViewRCrel (NumOfRows,NumOfCols: integer) Remarks The reference point may be adjusted to keep the viewing window within the virtual window limits. Works in any "WriteTo" mode. It does not update the viewing window. Restrictions None. See also VViewRC, VScrollView --------------------------------------------------------------------------- VZoomWindow procedure Wndw --------------------------------------------------------------------------- Function Toggles top virtual window between full screen size and original size. Declaration VZoomWindow Remarks If the window is less than full size, the window is zoomed to full size and centered if necessary. Executing the procedure again will restore the size and location of this window. If NoMoveMode or PermMode has been set for this window, the procedure is ignored. Shadows are fully supported. Margins are respected. Heap Maximum requirement is full screen size plus the underlay size. Exit Forced to write to CRT. See also VResizeWindow --------------------------------------------------------------------------- WEosC function Wndw --------------------------------------------------------------------------- Function Returns the window-relative column of the EOS marker. Declaration WEosC Result type byte Screens All video pages and virtual screens. Remarks Operates on the currently written screen. The upper left corner of the window is (1,1). See also WEosR, WEosToRC, WEosLn, WGotoEos Chapter 2, Procedures and Functions Page 21 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- WEosLn procedure Wndw --------------------------------------------------------------------------- Function Moves the EOS marker to column 1 of the next window-relative row with a possible scroll up. Declaration WEosLn Screens All video pages and virtual screens. Remarks Operates on the currently written window. If WEosR becomes greater than the number of window rows, then the window will scroll up. The new blank row will have the attribute set by WndwAttr which is the window attribute. EOS Updated to first cleared column of the cleared row. See also WEosR, WEosC, WEosToRC, WGotoEos --------------------------------------------------------------------------- WEosToRC procedure Wndw --------------------------------------------------------------------------- Function Positions the EOS marker relative to the current window. Declaration WEosToRC (Row, Col: byte) Screens All video pages and virtual screens. Remarks Use this procedure to manually locate the EOS marker. All EOS procedures will write where this marker is located on the currently written screen. EOS Updated. Restrictions Stay within the window limits. See also QWIK, WEosR, WEosC, WEosLn, WGotoEos --------------------------------------------------------------------------- WEosR function Wndw --------------------------------------------------------------------------- Function Returns the window-relative row of the EOS marker. Declaration WEosR Result type byte Screens All video pages and virtual screens. Remarks Operates on the currently written screen. The upper left corner of the window is (1,1). See also WEosC, WEosToRC, WEosLn, WGotoEos --------------------------------------------------------------------------- WBrdrH procedure Wndw --------------------------------------------------------------------------- Function Places a horizontal partition of the same type as the window border from edge to edge of the border. Declaration WBrdrH (Row: byte) Screens All video pages and virtual screens. Remarks This routine divides a window using WSbrdr, BrdrAttr from the top window record. It provides a horizontal line complete with a tee on each end using parts BrdrHL, BrdrLT, and BrdrRT. If SameAttr is used for BrdrAttr, then the attributes will remain the same on the screen. If there is no border, the procedure is ignored. EOS Unaltered. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrPart, WBrdrV, WLineH, WLinePart, WLineV Chapter 2, Procedures and Functions Page 22 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- WBrdrPart procedure Wndw --------------------------------------------------------------------------- Function Places a single border part of the same type as the window border at a window-relative location. Declaration WBrdrPart (Row,Col: byte; Part: BrdrParts) Screens All video pages and virtual screens. Remarks This routine places the part using WSbrdr, BrdrAttr from the top window record. It is usually used for crosses or tees, but there are 15 different parts that can be used. If SameAttr is used for BrdrAttr, then the attributes will remain the same on the screen. If there is no border, the procedure is ignored. EOS Unaltered. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrH, WBrdrPart, WLineH, WLineV, WLinePart --------------------------------------------------------------------------- WBrdrV procedure Wndw --------------------------------------------------------------------------- Function Places a vertical partition of the same type as the window border from edge to edge of the border. Declaration WBrdrV (Row: byte) Screens All video pages and virtual screens. Remarks This routine divides a window using WSbrdr, BrdrAttr from the top window record. It provides a vertical line complete with a tee on each end using parts BrdrVL, BrdrTT, and BrdrBT. If SameAttr is used for BrdrAttr, then the attributes will remain the same on the screen. If there is no border, the procedure is ignored. EOS Unaltered. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrH, WBrdrPart, WLineH, WLineV, WLinePart --------------------------------------------------------------------------- WClrEol procedure Wndw --------------------------------------------------------------------------- Function Clears a row to End-Of-Line (EOL). Declaration WClrEol (Row,Col: byte; Attr: integer) Screens All video pages and virtual screens. Remarks The row is cleared using the attribute Attr (SameAttr is permitted). To force the window attribute, use TWS.WndwAttr. EOS Set to (Row,Col). Restrictions Stay within window limits. See also WDelLine, WClrLine, WClrEos --------------------------------------------------------------------------- WClrEos procedure Wndw --------------------------------------------------------------------------- Function Clears a row from EOS to End-Of-Line. Declaration WClrEos (Attr: integer) Screens All video pages and virtual screens. Remarks The row is cleared starting at the EOS marker using the attribute Attr (SameAttr is permitted). To force the window Chapter 2, Procedures and Functions Page 23 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a attribute, use TWS.WndwAttr. EOS Unaltered. Restrictions Stay within window limits. See also WDelLine, WClrLine, WClrEos --------------------------------------------------------------------------- WClrField procedure Wndw --------------------------------------------------------------------------- Function Clears a field. Declaration WClrField (Row,Col,Cols: byte; Attr: integer) Screens All video pages and virtual screens. Remarks The field is cleared starting at (Row,Col) using the attribute Attr (SameAttr is permitted). To force the window attribute, use TWS.WndwAttr. EOS Set to (Row,Col). Restrictions Stay within window limits. See also WClrEol, WClrEos, WClrFieldEos --------------------------------------------------------------------------- WClrFieldEos procedure Wndw --------------------------------------------------------------------------- Function Clears a field starting at EOS. Declaration WClrFieldEos (Cols: byte; Attr: integer) Screens All video pages and virtual screens. Remarks The field is cleared starting at EOS using the attribute Attr (SameAttr is permitted). To force the window attribute, use TWS.WndwAttr. EOS Unaltered. Restrictions Stay within window limits. See also WClrEol, WClrEos, WClrField --------------------------------------------------------------------------- WClrLine procedure Wndw --------------------------------------------------------------------------- Function Clears a specified row. Declaration WClrLine (Row: byte) Screens All video pages and virtual screens. Remarks The row is cleared using the window attribute TWS.WndwAttr (SameAttr is permitted). EOS Set to (Row,1). Restrictions Stay within window limits. See also WDelLine, WClrEol, WClrEos --------------------------------------------------------------------------- WClrScr procedure Wndw --------------------------------------------------------------------------- Function Clears the entire window. Declaration WClrScr Screens All video pages and virtual screens. Remarks Clears the screen using the window attribute TWS.WndwAttr (SameAttr is permitted). EOS Set to (1,1). See also WClrLine, WDelLine, WInsLine Chapter 2, Procedures and Functions Page 24 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- WClrTitle procedure Wndw --------------------------------------------------------------------------- Function Clears the titles from the specified row. Declaration WClrTitle (TopOrBottomRow: DirType); Screens All video pages and virtual screens. Remarks Clears the top or bottom border where the titles are located and restores the original border if any. If WSbrdr=NoBrdr, the row is simply cleared. Works on both fixed and virtual titles. EOS Unaltered. See also TitleWindow, VUpdateTitle --------------------------------------------------------------------------- WDelLine procedure Wndw --------------------------------------------------------------------------- Function Deletes a line at a specified row, scrolls up the remaining part of the window and clears the bottom row. Declaration WDelLine (Row: byte) Screens All video pages and virtual screens. Remarks Similar to Turbo's DelLine, the indicated row of the window will be deleted. The bottom row is cleared with WndwAttr (SameAttr is permitted). The cursor is not moved, but is ready to be moved with WGotoEos as EOS is set to the first column of the cleared row. EOS Updated to first cleared column of the cleared row. Restrictions Stay within window limits. See also WInsLine, WScrollUp, WGotoEos --------------------------------------------------------------------------- WGotoEos procedure Wndw --------------------------------------------------------------------------- Function Positions the cursor to match the EOS marker on both fixed or virtual windows. Declaration WGotoEos Screens All video pages and virtual screens. Remarks The cursor is simply moved to match the position of the EOS marker of the currently written video page. TWS.WSwhereR and TWS.WSwhereC are also updated. For virtual windows, this routine also executes VUpdateCursor. EOS Unaltered. See also WEosR, WEosC, WEosToRC, WEosLn, WGotoRC, VUpdateCursor Restrictions EOS should be within window limits. Example Center a string in a window and place the cursor at the end of the string: WWriteC (1,'Correct (Y/N)? '); WGotoEos; --------------------------------------------------------------------------- WGotoRC procedure Wndw --------------------------------------------------------------------------- Function Positions the cursor relative to the window. Declaration WGotoRC (Row, Col: byte) Screens All video pages and virtual screens. Chapter 2, Procedures and Functions Page 25 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a Remarks The cursor is positioned to the currently written window. For virtual windows, this routine also executes VUpdateCursor. EOS Unaltered. Restrictions Stay within the window limits. See also WGotoEos, WhereR, WhereC --------------------------------------------------------------------------- WInsLine procedure Wndw --------------------------------------------------------------------------- Function Inserts a blank line at a specified row using the window attribute WndwAttr scrolling down the remaining part. Declaration WInsLine (Row: byte) Screens All video pages and virtual screens. Remarks Similar to Turbo's InsLine, the indicated row of the window is scrolled down and then cleared (SameAttr is permitted). The cursor is not moved, but is ready to be moved with WGotoEos as EOS is set to the first column of the cleared row. EOS Updated to first cleared column of the cleared row. Restrictions Stay within window limits. See also WDelLine, WScrollDown, WGotoEos --------------------------------------------------------------------------- WLineH procedure Wndw --------------------------------------------------------------------------- Function Places a horizontal line in the window using the window line set. Declaration WLineH (Row,Col,Cols: byte) Screens All video pages and virtual screens. Remarks This routine divides a window using WSline, WndwAttr from the top window record. It provides just a horizontal line using part BrdrHL. If SameAttr is used for WndwAttr, then the attributes will remain the same on the screen. If WSline=NoBrdr, then the procedure is ignored. EOS Updated. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrH, WBrdrPart, WBrdrV, WLinePart, WLineV --------------------------------------------------------------------------- WLinePart procedure Wndw --------------------------------------------------------------------------- Function Places a single line part of the same type as the window line set at a window-relative location. Declaration WLinePart (Row,Col: byte; Part: BrdrParts) Screens All video pages and virtual screens. Remarks This routine places the part using WSline, WndwAttr from the top window record. It is usually used for crosses or tees, but there are 15 different parts that can be used. If SameAttr is used for WndwAttr, then the attributes will remain the same on the screen. If WSline=NoBrdr, the procedure is ignored. EOS Updated. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrH, WBrdrPart, WBrdrV, WLineH, WLineV Chapter 2, Procedures and Functions Page 26 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- WLineV procedure Wndw --------------------------------------------------------------------------- Function Places a vertical line in the window using the window line set. Declaration WLineV (Row,Col,Rows: byte) Screens All video pages and virtual screens. Remarks This routine divides a window using WSline, WndwAttr from the top window record. It provides just a vertical line using part BrdrVL. If SameAttr is used for WndwAttr, then the attributes will remain the same on the screen. If WSline=NoBrdr, then the procedure is ignored. EOS Updated. Restrictions Stay within window limits. Cannot use NoBrdr. See also WBrdrH, WBrdrPart, WBrdrV, WLineH, WLinePart --------------------------------------------------------------------------- WriteAndViewPage procedure Wndw --------------------------------------------------------------------------- Function Changes the video page to be both viewed and written on the CRT. Declaration WriteAndViewPage (PageNum: byte) Screens All video pages. Remarks If another video page is available, this routine will switch to both view and write to that page. It does nothing if PageNum is already the currently written video page (QvideoPage) and viewed page (VideoPage), or if PageNum is invalid. All WndwStats are swapped to exact same conditions as before. EOS Restored to new page. See also WriteToPage, Qwik.QviewPage, Qwik.QwritePage --------------------------------------------------------------------------- WriteToCRT procedure Wndw --------------------------------------------------------------------------- Function Prepares QWIK and WNDW to write to the top window on the CRT and restores the Turbo window. Declaration WriteToCRT Screens Back to any video page. Remarks This procedure switches back to writing to the top window on the CRT after writing to a hidden window or virtual screen. EOS Restored to top window. See also WriteToHidden, WriteToVirtual --------------------------------------------------------------------------- WriteToHidden procedure Wndw --------------------------------------------------------------------------- Function Prepares QWIK and WNDW to write to a hidden window. Declaration WriteToHidden (WindowName: WindowNames) Remarks This procedure switches to writing to a hidden window. The window must be a valid window name, otherwise the program is terminated with an error message. EOS Restored to hidden window. See also WriteToCRT, WriteToVirtual Chapter 2, Procedures and Functions Page 27 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a --------------------------------------------------------------------------- WriteToPage procedure Wndw --------------------------------------------------------------------------- Function Changes the video page on which the WNDW routines write with out changing the viewed page. Declaration WriteToPage (PageNum: byte) Screens All video pages. Remarks If another video page is available, this routine will switch to write to that page. It does nothing if PageNum is already the currently written video page (QvideoPage) or if the page is invalid. All WndwStats are swapped to exact same conditions as before. EOS Restored to new page. See also WriteAndViewPage, Qwik.QwritePage --------------------------------------------------------------------------- WriteToVirtual procedure Wndw --------------------------------------------------------------------------- Function Prepares QWIK and WNDW to write to a virtual screen. Declaration WriteToVirtual (WindowName: WindowNames) Remarks This procedure switches to writing to a virtual screen. The window must be a valid window name, otherwise, the program is terminated with an error message. EOS Restored to virtual screen. See also WriteToCRT, WriteToHidden --------------------------------------------------------------------------- WScrollDown procedure Wndw --------------------------------------------------------------------------- Function Scrolls the current window down and clears the top row with the window attribute WndwAttr. Declaration WScrollDown Screens All video pages and virtual screens. Remarks The last row of the window will be scrolled out and lost while the first row will be cleared (SameAttr is permitted). The cursor is not moved, but is ready to be moved with WGotoEos as EOS is set to the first column of the cleared row. EOS Updated to first cleared column of the cleared row. Restrictions None. See also WScrollUp, WGotoEos --------------------------------------------------------------------------- WScrollUp procedure Wndw --------------------------------------------------------------------------- Function Scrolls the current window up and clears the bottom row with the window attribute WndwAttr. Declaration WScrollUp Screens All video pages and virtual screens. Remarks The first row of the window will be scrolled out and lost while the last row will be cleared (SameAttr is permitted). The cursor is not moved, but is ready to be moved with WGotoEos as EOS is set to the first column of the cleared row. Chapter 2, Procedures and Functions Page 28 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a EOS Updated to first cleared column of the cleared row. Restrictions None. See also WScrollDown, WGotoEos --------------------------------------------------------------------------- WWhereC function Wndw --------------------------------------------------------------------------- Function Returns the window-relative column of the cursor on the currently written video page. Declaration WWhereC Result type byte Screens All video pages only. Remarks Operates on the currently written video page. The upper left corner of the screen is (1,1). See also WGotoRC, WWhereR --------------------------------------------------------------------------- WWhereR function Wndw --------------------------------------------------------------------------- Function Returns the window-relative row of the cursor on the currently written video page. Declaration WWhereR Result type byte Screens All video pages only. Remarks Operates on the currently written video page. The upper left corner of the screen is (1,1). See also WGotoRC, WWhereC --------------------------------------------------------------------------- WWrite procedure Wndw --------------------------------------------------------------------------- Function Writes a string relative to the current window using the window attribute. Declaration WWrite (Row,Col: byte; aStr: string) Screens All video pages and virtual screens. Remarks This routine writes the string aStr at window-relative (Row,Col) with the attribute WndwAttr from the window record. If SameAttr is used for WndwAttr, then the attributes will remain the same on the screen. EOS Updated. Restrictions Stay within the window limits. Long strings will not wrap around to column 1. See also WWriteA, WWriteC, WWriteSub Example Write the string "Enter" at (2,1) with the current window attribute: WWrite (2,1,'Enter'); Example Write the string "Answer" at (2,1) with the attribute of flashing white on red and then restore the current window attribute: with TopWndwStat do begin WndwAttr := Blink+White+RedBG; Chapter 2, Procedures and Functions Page 29 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a Wwrite (2,1,'Answer'); WndwAttr := OrigAttr; end; --------------------------------------------------------------------------- WWriteA procedure Wndw --------------------------------------------------------------------------- Function Writes a string relative to the current window overriding the current window attribute. Declaration WWriteA (Row,Col: byte; Attr: integer; aStr: string) Screens All video pages and virtual screens. Remarks This routine writes the string aStr at window-relative (Row,Col) with the specified attribute. If SameAttr is used for Attr, then the attributes will remain the same on the screen. EOS Updated. Restrictions Stay within the window limits. Long strings will not wrap around to column 1. See also WWrite, WWriteC, WWriteSub Example Write the string "Enter" at (2,1) with Yellow on Blue attribute: WWriteA (2,1,Yellow+BlueBG,'Enter'); --------------------------------------------------------------------------- WWriteAC procedure Wndw --------------------------------------------------------------------------- Function Writes a string centered column-wise to the current window overriding the current window attribute. Declaration WWriteAC (Row: byte; Attr: integer; aStr: string) Screens All video pages and virtual screens. Remarks This routine writes the string aStr centered between the left and right columns of the window. If SameAttr is used for Attr, then the attributes will remain the same on the screen. EOS Updated. Restrictions Stay within the window limits. Long strings will not wrap around to column 1. See also WWrite, WWriteA, WWriteC, WWriteSub Example Write a message centered in a window on row 5 with a Black on LightGray attribute: WWriteAC (5,LightGrayBG,'My message'); --------------------------------------------------------------------------- WWriteC procedure Wndw --------------------------------------------------------------------------- Function Writes a string centered column-wise to the current window using the window attribute. Declaration WWriteC (Row: byte; aStr: string) Screens All video pages and virtual screens. Remarks This routine writes the string aStr centered between the left and right columns of the window. The attribute used is WndwAttr from the window record. If SameAttr is used for WndwAttr, then the attributes will remain the same on the Chapter 2, Procedures and Functions Page 30 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a screen. EOS Updated. Restrictions Stay within the window limits. Long strings will not wrap around to column 1. See also WWrite, WWriteSub Example Write a message centered in a window on row 5: WWriteC (5,'My message'); --------------------------------------------------------------------------- WWriteSub procedure Wndw --------------------------------------------------------------------------- Function Writes an array (or substring) with a specified length relative to the current window using the window attribute. Declaration WWriteSub (Row,Col: byte; SubStringLen: word; VAR aStr) Screens All video pages and virtual screens. Remarks This routine writes the array aStr at window-relative (Row,Col) for the number of columns specified by SubStringLen. This enables you to write substrings when specifying a starting index (aStr[i]). (Other routines like WWrite assume the length is the value at aStr[0] and the starting index is aStr[1].) Of course, aStr doesn't have to be a string - it can be any type variable or address in memory. The attribute used is WndwAttr from the window record. If SameAttr is used for WndwAttr, then the attributes will remain the same on the screen. EOS Updated. Restrictions Stay within the window limits. Long strings will not wrap around to column 1. See also WWrite, WWriteC Example The following will write "Testing out this line." with the current window attribute: MyString := 'Step B: Testing out this line.'; WWriteSub (1,1,22,MyString[9]); Chapter 2, Procedures and Functions Page 31 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a 3. D A T A S T R U C T U R E This section will help describe the data structure of WNDW and how it can be adjusted. The variables in W70-VAR.INC are allocated according to the conditional directives and constants set at the beginning of the file. There are several basic variables, but if desired, there are additional variables for virtual windows and multiple video pages. Please refer to the source code in W70-VAR.INC for the exact listing. BASIC TYPES Basic Types - These types are used for all windows and modes to define the data structure. This will describe the purpose of each type. Type Description ------------ ----------------------------------------------------------- Borders This enumerated type gives a name for 15 different border styles each having 15 different parts already assigned in the constant array Brdr. The name NoBrdr is reserved. NoBrdr - No border at all. Just the text area. BlankBrdr - Blank character on all sides. SingleBrdr - Single lines on all sides. DoubleBrdr - Double lines on all sides. HdoubleBrdr - Horizontal double lines. Single vertical lines. VdoubleBrdr - Vertical double lines. Single horizontal lines. SolidBrdr - Solid box character on all sides. EvenSolidBrdr - Vertical solid box. Horizontal half box. ThinSolidBrdr1 - Half box on all sides. Squeezed horizontally. ThinSolidBrdr2 - Half box on all sides. Squeezed vertically. LhatchBrdr - Light hatch character on all sides. MhatchBrdr - Medium hatch character on all sides. HhatchBrdr - Heavy hatch character on all sides. UserBrdr1 - User defined border. UserBrdr2 - User defined border. BrdrParts Each border has 15 different parts. This enumerated type identifies each part by name. Using acronyms, the relative position can be easily identified. For example, BrdrTL means the Top Left border part. The order corresponds with the BrdrRec type: Relative Position The first letter means: ------------------ T = Top B = Bottom TL TH TT TH TR V = Vertical H = Horizontal LV VL RV L = Left R = Right LT HL CL HL RT C = Cross LV VL RV Second letter exceptions: BL BH BT BH BR T = Tee L = Line Chapter 3, Data Structure Page 32 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a BrdrRec This type provides the structure for each border style to access all 15 different parts. By having a tag field, two different methods can be used to address the parts. DirType This enumerated type identifies various directions. They can be extended. MarginRec Groups the margins used for moving or resizing windows. WindowNames This enumerated type gives a name or handle for each window to uniquely identify a window record for random access. Any additional name can be used, but three are reserved: Name Description ---------- --------------------------------------------- Window0 Identifies the initial base screen and must be first in the list. FreeWindow Identifies virtual screen records that are free to be overwritten. aWindow A generic name to be used when the window does not need to be unique. It is usually used for temporary windows like error messages. WndwStatType This type sets up the basic structure to a window record. Each field in record is worth describing. The WS prefix is an acronym meaning WndwStat. There is 50 bytes per record. WSrow .. WScol2 - These variables identify the location and size of the window INCLUDING the border if any. The "2" suffix means the right column or bottom row location. Wrow .. Wcol2 - These variables identify the location and size of the window EXCLUDING the border if any. The "2" suffix means the right column or bottom row location. WndwAttr/BrdrAttr/OrigAttr - These the attributes for the window and border respectively. The value can even be SameAttr. OrigAttr is a second copy of WndwAttr used to restore WndwAttr to its original value. WSbrdr/WSline - The former is the current border style while the latter is a line set that can be used within the window. When a window is made, these two values are the same, but WSline is available to be changed to the needed line set. WSname - The unique name assigned to the window record. WSwhereR/WSwhereC - These variables save the window- relative row and column of the cursor. WSmodes - Saves all the modes that created the window including the current status. Chapter 3, Data Structure Page 33 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a WScursor - Save the cursor mode used with this window. ULcol .. ULbytes - Saves the location and size of the underlay of a window including the border and shadow if any. ULptr - Points to the saved underlay in the heap. VScrRec - Holds the QWIK screen data for this window. RefRow/RefCol - These two scratch coordinates are used for two cases. It saves the absolute row/col where a window is positioned before it is hidden. For virtual screen stats, it saves the view reference point. ViewBrdr - Saves the border style originally created with the window. WSbrdr differs from ViewBrdr in that WSbrdr contains the current border. For virtual screens, WSbrdr is always NoBrdr even though the view on the CRT may be a different style. VI - Virtual screen index for its associated virtual window stat if any. WndwStatsType Sets up the total number of WndwStat records for the program which defined by the constant MaxWndw. VirtualStatsType Sets up the total number of VirtualStat records for the program which defined by the constant MaxVirtualWndw. WordArray Used to identify each Character/Attribute combination from a screen. The range of the array is irrelevant. WordArrayPtrType A pointer of WordArray. TYPED CONSTANTS Typed Constants - These constants set defaults used to create window borders, shadows and titles. Constant Description ------------ ----------------------------------------------------------- Brdr Contains 14 different border styles each with 15 border parts. The flexible data structure enables you to get parts with either of two methods - by field identifier or by index name. For example, it is easiest to use the field identifier: MyPart := Brdr[SingleBrdr].TL Since field identifiers can't be passed as parameters, the index names must be used. To get the same result if the name BrdrTL is passed as a value: Chapter 3, Data Structure Page 34 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a MyPart := Brdr[SingleBrdr].BrdrArray[BrdrTL] Both methods use the same code; the former is simply easier to write. PreferMultiTask This boolean defaults to false so that would ignore any multi-tasking environment. When set to true just before InitWindow, WNDW will then use the higher speed video buffer (MTVB) if available. ShadowChar This is the character used to produce a shadow which is set equal to a space. This may not be desirable for monochrome monitors which may look better with hatch characters. ShadowColor This is the attribute used to produce a shadow which is set to Black on Black. Any attribute can be used. TitleOfs When writing titles, this offset is used to adjust where the title starts writing. Left justified titles start at Wcol+TitleOfs while the Right end at Wcol2-TitleOfs. Center justified titles are not affected. The default is 1. UNTYPED CONSTANTS Untyped Constants - These constants are used to control the data structure size or to conveniently set window mode bits. Constant Value Description -------------- ----- -------------------------------------------------- MaxWndw 1-254 Set by the user, this value determines the maximum number of windows that can be on the CRT on any video page. This sets the amount of global data to be used. MaxVirtualWndw 0-254 Set by the user, this value determines the total number of virtual screens minus one that will be maintained at any one time. If no virtual windows are wanted, undefine the directive AddVirtual. MaxPageUsed 0 - 7 Set by the user, this value determines the highest page number to be managed in a multi-page program. If only page 0 is going to be used (which is usually the case), then undefine the directive MultiPage. This will reduce the global data by a significant amount. Window Modes - There are several window modes and combination of modes that can be set using SetWindowModes and saved in the variable WindowModes. This is a list of those modes, values and descriptions. After the window is created, the modes are saved in WSmodes as well as the "To*" modes which indicates the status of the window. Chapter 3, Data Structure Page 35 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a Constant Value Description -------------- ----- -------------------------------------------------- RelMode $0001 (Bit 0) Simply overwrites the screen relative to the current window. The Row/Col coordinate is window relative. Works and stays in the current WriteTo mode. This is usually used for flexible screen design. The stats are only temporary and lost after changing windows. To get back to the parent window, use RemoveWindow. PermMode $0002 (Bit 1) Makes the window permanent on the screen - no underlay is saved. These windows must be the first ones created. They can be accessed, but be sure no other window is covering it (WI<=PLI) because they are not necessarily the top window. before writing to the screen. ShadowLeft $0004 (Bit 2) Places a shadow on the left side. ShadowRight $0008 (Bit 3) Places a shadow on the right side. ShadowTrans $0010 (Bit 4) Creates transparent shadows. ZoomMode $0020 (Bit 45 Creates a zoom effect with MakeWindow, ShowWindow, and AccessWindow. HiddenMode $0040 (Bit 6) Creates the window as hidden. VirtualMode $0080 (Bit 7) Creates a virtual window with a virtual screen. CursorOffMode $0100 (Bit 8) Always leaves cursor off. SeeThruMode $0200 (Bit 9) Doesn't clear screen inside the border and ignores ZoomMode. NoHideMode $0400 (Bit 10) Ignores request to hide window. NoAccessMode $0800 (Bit 11) Ignores request to access window. NoMoveMode $1000 (Bit 12) Ignores request to move/resize window. ToCRTmode $2000 (Bit 13) Indicates writing to CRT. ToHiddenMode $4000 (Bit 14) Indicates writing to hidden window. ToVirtualMode $8000 (Bit 15) Indicates writing to virtual screen. GLOBAL VARIABLES Global Variables - Finally, the variables used in WNDW can be described in detail and can be accessed by the user. Window Flags - While writing to a window, it is difficult to try to analyze the bits in WSmodes to figure out its modes. So, each mode has been given a corresponding boolean flag. These flags are set for the current window. Though rather intuitive, the flag variables is listed below with its corresponding mode: Flag Mode -------------- -------------- RelFlag RelMode PermFlag PermMode ZoomFlag ZoomMode HiddenFlag HiddenMode VirtualFlag VirtualMode CursorOffFlag CursorOffMode SeeThruFlag SeeThruMode Chapter 3, Data Structure Page 36 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a NoHideFlag NoHideMode NoAccessFlag NoAccessMode NoMoveFlag NoMoveMode ToCRTflag ToCRTmode ToHiddenFlag ToHiddenMode ToVirtualFlag ToVirtualMode Single Page Variables - The following variables are grouped together because they are specific to the current video page being used. If you do use more than one page, these variables will be swapped with another page. Variable Description -------------- --------------------------------------------------------- WndwStat (Type: WndwStatsType) This is the array for the maximum number of windows both hidden and shown at one time. Each record only uses 52 bytes of global data. WndwStat[0] is always the record for the initial window. TopWndwStat (Type: WndwStatsType) This record makes it easy to always access the data for the current window and is always up-to-date. This data will be saved in the correct WndwStat before accessing another window. TWS (Type: WndwStatsType) This is the same as TopWndwStat, but just easier to write. TopVirtualStat (Type: WndwStatsType) For virtual windows, in addition to TWS, there is the TopVirtualStat for the associated virtual screen which has its own record. TVS (Type: WndwStatsType) This is the same as TopVirtualStat, but just easier to write. Keep in mind that when writing direct to the virtual screen (WriteToVirtual), TWS and TVS are reversed. It would then be helpful to think of TVS as the top VIEW stat, since the view is on the CRT. LI (Type: Word) This is the top Level Index for the top window currently shown on the CRT. Windows shown on the CRT are sequentially stacked from index 0 upward. HLI (Type: Word) This is the Hidden Level Index which are stacked from index equal to MaxWndw downward. If there are no hidden windows, HLI=MaxWndw+1. WI (Type: Word) For the current Window Index, the program saves and retrieves the WndwStat from this index whether it is hidden or shown. It ranges from 0 to MaxWndw. For hidden windows, can range from HLI to MaxWndw. For the top window on the CRT, WI=LI. For PermMode windows, it can be <=LI. PLI (Type: Byte) This Permanent Level Index keeps track of the order of the permanent windows on the CRT. They must be stacked contiguously as the first ones on the CRT or Chapter 3, Data Structure Page 37 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a else an error message will be displayed. This value is <=LI. CursorDefault (Type: word) This is the value saved from SetCursorDefault for the cursor mode which can be just as easily set directly. When MakeWindow is used, this is the value saved for that window. Margins (Type: MarginRec) These margins limit the moving or resizing of windows for each video page. This prevents windows from covering status lines or the like. WindowModes (Type: word) This is the value saved from SetWindowModes. It is best to use the procedure for this value since it filters out incompatible modes. TopPageStat (Type: PageStatRec) Rather than being redundant, the above ten variables for a single page are all contained in this record. This makes it easy to swap data with other page. This is the data currently being used on the screen. Universal Variables - These variables are not specific to any window or video page and are used universally in the program. Variable Description -------------- --------------------------------------------------------- VirtualRows (Type: byte) This is the row height saved from SetVirtualSize setting the number of rows used in the virtual screen. The default is CRTrows. VirtualCols (Type: byte) This is the column width saved from SetVirtualSize setting the number of columns used in the virtual screen. The default is CRTcols. VirtualSize (Type: word) This is the size in bytes to be reserved for the virtual screen. The size is VirtualCols * (VirtualRows+2) * 2. Remember the last two rows are added for the virtual titles. MaxValidPage (Type: byte) The program can reserve enough data for all video pages being address with MaxPageUsed. However, the machine that runs the program must have those pages available. This variable additionally limits the pages that can be addressed which is the lesser of MaxPage or MaxPageUsed. ZoomDelay (Type: byte) This value is set by InitWindow to control the zoom rate on non-snowing video cards. This value is set according to the CpuID. CrtWI (Type: word) This value saves the last index that is being used to indicate which window is active on the CRT. The value is always CrtWI<=LI and is primarily used to indicate which window has the cursor. Chapter 3, Data Structure Page 38 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a DYNAMIC VARIABLES Dynamic Variables - These variables are allocated to the heap to leave more room for global variables. They are allocated in InitWindow. Pointer Description -------------- --------------------------------------------------------- VirtualStat (Type: ^WndwStatType) This array of window records is for the virtual screens associated with the virtual windows. All routines use this data when writing to virtual screens by copying it to TWS. The index for this record is obtain from TWS.VI. Since this array is filled at random, VI does not correspond to WI. When a virtual window is removed, these stats are "freed" by renaming WSname to FreeWindow - they are not freed by FreeMem. All video pages use this one array. PageStat (Type: ^PageStatRec) If your program uses multiple video pages, a complete record of all the window records and indexes are saved for each video page. These can be easily swapped with TopPageStat to work on the current video page. The WriteToPage procedure handles this operation. Chapter 3, Data Structure Page 39 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a A P P E N D I X A : M E M O R Y A L L O C A T I O N This section covers the memory requirements for global data in the data segment and dynamic data in the heap. This will give you the figures on how to calculate the memory needed for your program. GLOBAL MEMORY Global Memory - WNDW is very frugal with global data. Here is the breakdown on the fixed amount of data required: Variables Bytes ------------------------------- ----- Border array constants 210 Basic windows 146 Additional for virtual windows 69 Additional for multi-page video 4 ----- Fixed allocation 429 The additional for virtual windows and multi-page video can be deleted with directives if not used. This is the allocation for MaxWndw=0. For each additional window record, add 52 bytes. So, for MaxWndw=10, the allocation would be (52*10)+429=949 bytes. DYNAMIC MEMORY Dynamic Variables - To alleviate using global data, dynamic variables are used for permanent and temporary use. The allocation for virtual screen records and video page records are permanent throughout the program. Many other procedures such as MoveWindow temporarily use the heap to perform operations. Permanent Variables - If the directives have been defined, the following allocation can be calculated: Variables Bytes --------------- ------------------------------- VirtualStat 52 per virtual window PageStat (SizeOf(TopPageStat)) per video page Virtual screen VirtualSize Virtual screens are kept in memory until RemoveWindow is used. Temporary Variables - For procedures that temporarily use the heap, the size of allocation is listed along with each procedure in section 2 above. Generally, you should allow about the same size as 3 CRT screens of available Heap for those procedures. For a video mode with 25 rows and 80 columns, this is (80*25*2)*3=12000 bytes. This should be added in addition to the random allocation. Random Allocation - Because of the nature of random access to windows and underlays, the program uses GetMem and FreeMem. This means that there are Appendix A: Memory Allocation Page 40 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a going to be gaps of free memory in the heap. To account for this, you should more than double the amount of data expected for underlays and virtual screens. It is up to you to judge just how must of the heap is going to be truly random. In the case of simple serial-access to windows, the heap will be contiguous and doubling of the heap is unnecessary. CODE SIZE Code Size - WNDW is also very frugal with with code. Here is the breakdown for code usage (this may vary slightly): Code Description Bytes ------------------------------- ----- Basic windows 8632 Additional for virtual windows 3957 Additional for multi-page video 265 Additional code for shadows 893 ----- Total code 13747 Of course the smart compiler will optimize the code leaving out unused procedures. But this gives you a good idea of how small the code really is! If you do not need the additional code, use the compiler directives in the WNDW70A.PAS unit to eliminate it. Appendix A: Memory Allocation Page 41 WNDW Multi-level Virtual Windows Reference Guide, Version 7.0a A P P E N D I X B : E R R O R M E S S A G E S Because WNDW is so powerful, it writes to screen in memory as well as the CRT. Should you make a mistake in programming, it may not show up on the CRT screen. So, to prevent the errors before they happen, programs written with errors will terminate with an error message window on the CRT to reveal the problem. The program terminates through the GOOF unit which can be freely edited. "Not enough heap space" - The minimum heap size is too small. Increase the size as required in APPENDIX A. "Too many windows" - Tried to create more windows than MaxWndw allows. Either remove windows or increase MaxWndw. "Too many virtual windows" - Tried to create more virtual windows than MaxVirtualWndw allows. Either remove windows or increase MaxVirtualWndw. "Perm window out of order" - Tried to create a PermMode window while a normal window is the top window. Remove or hide window before making a permanent window. Routinely, all PermMode windows are created first. "No window to remove" - Tried to remove the initial window Window0 which is permanent. "Hidden window not found" - Tried to write to a hidden window that does not exist. Check for the correct name. "Virtual screen not found" - Tried to write to a virtual screen that does not exist. Check for the correct name. "Video page not available" - Tried to write to a video page that has not been allocated or does not exist for the hardware as expected. Be sure to use MaxValidPage. Appendix B: Error Messages Page 42