home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
turbopas
/
wndw40.arc
/
WNDW40.DOC
< prev
next >
Wrap
Text File
|
1987-12-12
|
14KB
|
296 lines
December 12, 1987
MULTI-LEVEL
RANDOM-ACCESS
WINDOWS
Version 4.0
PURPOSE:
Two units create incredibly quick multi-level, random-access
windows in Turbo Pascal 4.0 programs for all IBM and compatibles
including the new PS/2 systems, PCjr, PC convertible, and 3270 PC.
They work in all text modes and any column mode (40/80/etc.) using
the quick screen writing utilities of QWIK40.TPU. The entire code
is only 7.4k bytes for all utilities.
TEST DRIVE:
Compile and run the tutoring program WNDWDEMO.PAS to get a feeling
for features and speed. For a demo of window management with
random-access windows, run WMGRDEMO.PAS. Both demos use the same
code, but were just applied differently.
FILES:
In this version, WNDW40.ARC contains:
!_read .me!: File that insists you get a copy of QWIK40.ARC.
Qwik40a .tpu: Unit for quick screen writing.
WndwVars.pas: Unit source code for variables used in
WNDW40.TPU.
WndwVars.tpu: Unit of WNDWVARS.PAS.
Wndw40 .tpu: Unit for your programs to use windows.
Wndw40- .pas: Partial source code listing of WNDW40.TPU.
Wndw40 .doc: This document.
WndwDemo.pas: Demo of WNDW40.TPU and QWIK40.TPU which also
gives a tutorial of user instructions.
WmgrDemo.pas: Demo of window management with random-access.
License .arc: ARC file containing license agreements
IMPROVEMENTS:
Obviously, this program was modified to work with TP 4.0. In
addition, several new features were added for random-access
windows. Compared to WINDOW34.INC, the code has been overhauled
and many improvements in code optimization were made as noted
below and in the demos. However, the changes necessary to upgrade
your code are minimal.
PROCEDURES:
WNDW40.TPU - This unit has the full capabilities of window
management of random-access windows. Note that WNDW40.TPU uses
QWIK.TPU and WNDWVARS.TPU. MaxWndw is fixed at 30 windows and the
window names have all been assigned. In order to make any
changes, the complete source code will be required to still have
the full window management utilities.
WNDW40-.PAS - The procedures in WNDW40.TPU are only partially
listed in WNDW40-.PAS. I have decided not to disclose some of the
more critical procedures in window management in this ARC file.
This means that you can make some changes in WNDWVARS.PAS, but
only the BASIC (serial-access) window utilities will be compiled
in WNDW40-.PAS. The length of the complete source code is over
1000 lines. Of course, those registered can receive the source
code upon request.
SHAREWARE:
These procedures are ShareWare. The cost may range from $6 to $32
depending on your application. I do enjoy assisting others in
their programming, but lack of reimbursement is expensive for me!
Please help out. See the STATMENT.LIC in LICENSE.ARC for details.
If the response will let me break even, I will continue support.
UPGRADING:
QWIK - Refer to the notes in QWIK40.ARC for upgrading the QWIK
utilities.
Modes - All the modes are kept as bit flags in the global variable
called WindowModes. ShadowDir and FixedWindow have been
converted into one of the modes listed below. Contrary to what
you might expect, FixedWindow corresponds to the constant PermMode
and not FixedMode. None of the modes are tripped back to clear
and remain unaltered until you change them. Each window saves a
copy of WindowModes when it was created in the variable WSmodes.
The constants listed below have the appropriate bit flag set.
PermMode - This window will saves the underlay and is
permanent. So, it can't be moved, hidden, or
accessed. Use this for the first windows
placed on the screen.
FixedMode - the underlay is saved in this mode, but it
prevents the user from moving or accessing
it randomly, such as pull-down menus.
ShadowLeft - a shadow is placed on the lower left corner.
ShadowRight - a shadow is placed on the upper right corner.
ZoomMode - this creates the zoom effect when the window
is made, accessed or shown.
HideMode - This is handled by WNDW40. It will tell you
the status of the window. It shouldn't be
set by the programmer. Another way to tell
if a window is hidden is with GetLevelIndex.
If the value is greater than LI, it's hidden.
To set the modes for subsequent MakeWindows, use the following:
SetWindowModes (ZoomMode+ShadowRight);
You could just as easily assign WindowModes manually:
WindowModes:=ZoomMode+ShadowRight;
SetWindowModes just makes sure you don't have two shadows turned
on and clears the HideMode. The default is all modes off.
WindowModes will apply to all subsequent MakeWindows.
MakeWindow - This procedure now requires a unique name so it can
be identified for random-access. If you don't intend to use
random-access, any name will do.
TitleWindow - One more parameter was added to work on the top or
the bottom border. Simply include the constant Top or Bottom.
Programming Errors - Programming errors now appear as a centered
flashing window rather than using a writeln statement. The code
is in WNDWVARS.PAS and you can easily modify it or eliminate it
altogether. Writeln is no longer used anywhere in the units.
WndwStat - Several new variables were added in the WndwStat record
for ease of use. The UnderLay is the screen data that is
overwritten by the new window. With a shadow, it adds 2 more
columns and one more row. These dimensions are kept as "UL"
variables.
TopWndwStat - The current window stats are always maintained in
the global record TopWndwStat. Combined with a with statement,
the code is optimized just like simple global variables. So use
TopWndwStat in lieu of WndwStat[LI].
Tattr - Change all references to Tattr to TextAttr which is
Turbo's text attribute for Writeln.
Suppressing Attributes - The use of a negative number to suppress
attribute changes in the creation of a window is now possible. I,
personally, cannot think of a reasonable application of this per
se. However, if you chose to do so, remember that TextAttr will
be set to the lo byte portion of the integer Wattr. To have both
a selected TextAttr and a negative number, give the Wattr
parameter the following value:
$FF00 + MyForeground + MyBackground
Turbo will compile it down to an integer.
ADDITIONAL NOTES:
QWIK40A.TPU - If you have QWIK40.ARC, replace your QWIK40.TPU with
QWIK40A.TPU. The earlier version always left SubmodelID as zero.
It is corrected in this version.
QWIK - The demos WNDWDEMO.PAS and WMGRDEMO.PAS cover most of the
instructions for use, but users should also read QWIK40.ARC to get
the most of these procedures. For instance, WNDW40.TPU can work
on up to 8 display pages depending on your video card. Turbo
Pascal procedures only work on the first page, page 0. This is
where QWIK utilities come in. They will work on any page. Even
though WNDW40.TPU will seem to make a Turbo Window on say page 3,
the standard procedures of WriteLn, Window, GotoXY, etc. will not
work there. You must then use QWIK for those pages. QWIK also
works in absolute screen coordinates and are not limited to the
Turbo Window dimensions. There may be later versions of QWIK, so
use the latest one.
Heap - The memory requirement for the heap depends on whether your
program uses serial or random access, the latter requiring about
twice as much. For serial access, the heap is:
Total Bytes = (Sum of the underlay bytes for all windows) +
2*(underlay bytes of the largest window)
Underlay bytes are just the Rows*Cols*2. If you have a shadow,
you must add 1 to Rows and 2 to Cols. The last part about the
largest window is a requirement only if MoveWindow or ScrollWindow
is used. For random access, the heap is:
Total Bytes = 2*(Sum of the underlay bytes for all windows) +
(Underlay bytes for the largest window)
The need for the doubled size is to account for the maximum
possibility of gaps due to RemoveWindow being used. If it is not
used, then use the serial access size.
Stack - Stack checking has been turned off in the unit. Less than
1k is used for any procedure.
Small Windows - Remember that a Turbo window cannot have less than
2 rows or columns and still work scrolling and wrap-around.
Hatch Borders - With the 9x16 character cell size on the new VGA
adapters being the same as MDA, the hatch characters (ASCII 176,
177, 178) are only 8x16 in a 9x16 cell. This unfortunately
produces a horizontal gap between the characters not seen on the
CGA. Be aware of the effect.
Full Screen Windows - Be sure to remember when you turn on a
shadow, especially on the left side. If you try to make the
window in Col=1, the shadow will wrap around to the other side of
the screen leaving a black column. In addition, it will not be
removed correctly, because it will think the underlay starts at
Col=-2 which translates to 254 in byte.
Pull-down Menus - An application of windows is multi-level pull-
down menus. I have already created some very thorough code in a
file called PULL20.ARC. It is fully featured and fully
configurable. Includes execute, single, and multiple choice
menus, unlimited nested submenus, data entry windows, help
windows, message system, fully completed interfaces. Scheduled
release is now 01-12-88.
On-line source - All updated files can be found on the CompuServe
Borland Forum (GO BPROGA) in the TP 4.0 data library or in the IBM
Software Forum (GO IBMSW).
LIABILITY:
No liabilities are assumed in the use or misuse of these
procedures.
CREDITS:
The initial program was developed by Michael Burton in his copy
of WINDO.INC, ver 2.4. The program was edited by permission and
re-released as WINDOW30.ARC.
Copyright (c) 1986,1987 by James H. LeMay, Michael Burton
Even though this is source code, it is still protected by the
United States Copyright Law.
Current author:
Jim LeMay, 6341 Klamath Rd., Ft. Worth, TX 76116
1-(817) 732-7150 (after 1730 PST), CIS 76011,217
Initial author:
Michael Burton, 15540 Boot Hill Rd., Hayden Lake, ID 83835
1-(208)-772-9347 (after 1800 PST)
Special effects concepts were graciously suggested by:
Rick Fothergill, 141 Oak Hill Road, Pittsfield, MA 01201
Data: 1-(413)-499-7245, CIS 76210,443
GEnie Mail: R.FOTHERGILL
REVISIONS:
Version 4.0 (12-12-87):
. Incorporated QWIK40.TPU for full IBM compatibility.
. Combined all modes into one variable - WindowModes.
. Added the following procedures/functions:
SetWindowModes
RestoreTurboWindow
PartitionWindow
PartitionCross
ClearTitle
ClearWindow
HideWindow
ShowWindow
MoveWindow
AccessWindow
GetLevelIndex
. Added 7 background constants.
. MakeWindow now requires a WindowName.
. TitleWindow requires one more direction parameter.
. Current WndwStats are kept in TopWndwStat rather than
WndwStat[LI].
. LIcurrent was deleted.
. Changed BrdrRec type for easier modifications.
. Added 3 more borders - VdoubleBrdr, ThinSolidBrdr2, UserBrdr2.
. Changed the following names:
MixedBrdr to HdoubleBrdr
ThinSolidBrdr to ThinSolidBrdr1
Tattr to TextAttr { Assigned by Borland }
Version 4.0a (12-12-87):
. Set the correct dates for WNDWVARS.TPU and WNDW40.TPU.