home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
pb
/
library5
/
lrwind.doc
< prev
next >
Wrap
Text File
|
1990-07-09
|
5KB
|
94 lines
LRWIND.PBU (Leithauser Research Windows) is a simple
window function for PowerBASIC. The emphasis here is on
SIMPLE. There are several more powerful wind functions
available. However, they are more complicated to use. More
important, they add up to 40 K to your program size, even if
you don't use most of the features the function offers.
LRWIND.PBU adds only 4 K.
To use the window function, just put $LINK "LRWIND.PBU"
in your program. To call the function, the command is
CALL Wind(XPosition%, YPosition%, BackgroundColor%,
ForegroundColor%, MessageArray$(), MakeOrRemove%)
In this command, you can (and probably should) replace
all of these variables except MessageArray$() with constants.
Thus, the actual command would look more like
CALL Wind(20,10,0,15,M$(),1)
The variables or constants have the following significance:
XPosition% is the column where the window border starts. That
is, the left side of the window.
YPosition% is the position of the top of the window border.
BackgroundColor% and ForegroundColor% and the colors of the
background and foreground of the text within the window.
MessageArray$() is the name of the array that contains the
text you want to appear in the window. You must put this text
into the array, starting at MessageArray$(1), before you call
the window function. The array element after the last line of
the message must contain an empty string. For example, your
program might look like this:
M$(1)="First line":M$(2)="Second line":M$(3)="":CALL
Wind(30,12,0,15,M$(),1)
MakeOrRemove% is either zero or any nonzero number. If the
number is nonzero the function prints the window on the
screen. If MakeOrRemove% equals zero, the function removes the
existing window, restoring the original screen under it. In
that case, all the other values are dummies, and have no
effect. However, values of the proper type (integers and a
string array) must be put in the proper places.
This window function allows you to put only one window on
the screen at a time. If you put more than one on the screen
at once, the function can only remove the last one.
This window function handles all of the windowing work
automatically. It looks at the contents of the MessageArray$
array and determines how high and wide the window must be. It
puts a border around the window, saves the screen, and prints
the window. It then returns control to your program. Your
program can then take the proper action while the window is on
the screen. For example, if the contents of MessageArray$ list
a numbered menu and then say "Press Number of your choice.",
your program can then wait for a numbered key press. After the
user presses a key, your program would call the window
function again with a zero in the MakeOrRemove% position to
remove the window. The window function restores all
parameters, such as printing color and cursor location,
after a window is either created or removed.
Because of the border, the window is two lines higher
than the number of lines in MessageArray$ and four characters
wider than the longest line in MessageArray$. If you use a
value for XPosition% or YPosition% that causes the window to
run off the screen, the window function will move the window
to avoid this.
This package contains a BASIC demonstration program,
WINDDEMO.BAS, to demonstrate how to use the window function.
Any other questions you might have about using the window
function should be answered by running and examining this demo
program.
Shareware fee and related stuff
This program is copyrighted. You may distribute the
package containing LRWIND.PBU, WINDDEMO.BAS, and LRWIND.DOC,
provided that all three files are kept in the package and you
do not charge more than a token fee (no more than $10). If you
use LRWIND.PBU in any of your programs, you are required to
register the package by sending $5.00 to:
David Leithauser
Leithauser Research
4649 Van Kleeck Drive
New Smyrna Beach, FL 32169
If you would like the source code for LRWIND.PBU, just
include an extra $.50 for postage and handling when you
register, and I will send you a printed listing of the source
code.
Once you have registered, you may use LRWIND.PBU in any
and all of your programs. It is not necessary to pay
separately each time you use LRWIND.PBU in a new program.
This package is also a demonstration of the work done by
Leithauser Research, a custom programming service. If you have
a need for an unusual program that you cannot find
commercially, send a description of the program and ask for an
estimate. Rates are very reasonable.