BBS: Inland Empire Archive Date: 02-15-93 (15:17) Number: 325 From: MARK HARRIS Refer#: NONE To: ALL Recvd: NO Subj: Winsubs For prime prog Conf: (2) Quik_Bas
------------ CUT HERE -------------------
' Shadowed window routines by Mark H Butler placed into the public domain
' on February 28, 1992 (bye bye babies). I would appreciate any feedback
' on these routines and if you improve on them I'd kinda like to know what
' you did so I can benefit by the improvements to. If that's a deal then
' enjoy the routines... there all yours now.
DECLARE SUB Drawbox (UpRow%, LtCol%, LoRow%, RtCol%)
DECLARE SUB Shadow (UpRow%, LtCol%, LoRow%, RtCol%)
DECLARE SUB Explode (UpRow%, LtCol%, LoRow%, RtCol%)
SUB Drawbox (UpRow%, LtCol%, LoRow%, RtCol%) STATIC
' This routine draws a double line box to the dimensions set
' in UpRow%, LtCol%, LoRow% and RtCol%. If you want a single line box
' just change the ascii chars, e.g. change CHR$(205) to CHR$(196) etc.
'
Wide% = (RtCol% - LtCol%) - 1
LOCATE UpRow%, LtCol%
PRINT CHR$(201); STRING$(Wide%, CHR$(205)); CHR$(187);
FOR I% = UpRow% + 1 TO LoRow% - 1
LOCATE I%, LtCol%
PRINT CHR$(186); SPACE$(Wide%); CHR$(186);
NEXT I%
LOCATE LoRow%, LtCol%
PRINT CHR$(200); STRING$(Wide%, CHR$(205)); CHR$(188);
END SUB
SUB Explode (UpRow%, LtCol%, LoRow%, RtCol%) STATIC
' This routine will "explode" the window onto the screen calling on
' DRAWBOX to draw sucessively larger boxes until it hits the limits
' set in UpRow%, LtCol%, LoRow% and RtCol%. The first few lines determine
' where the approximate center of the box begins even if the window is
' to be located off-center with respect to the screen.
'
RowCenter% = ((LoRow% - UpRow%) / 2) + UpRow%
ColCenter% = ((RtCol% - LtCol%) / 2) + LtCol%
UprRow% = RowCenter%: LeftCol% = ColCenter%
LwrRow% = RowCenter%: RghtCol% = ColCenter%
DO
UprRow% = UprRow% - 1
LeftCol% = LeftCol% - 3
LwrRow% = LwrRow% + 1
RghtCol% = RghtCol% + 3
IF UprRow% < UpRow% THEN UprRow% = UpRow%
IF LeftCol% < LtCol% THEN LeftCol% = LtCol%
IF LwrRow% > LoRow% THEN LwrRow% = LoRow%
IF RghtCol% > RtCol% THEN RghtCol% = RtCol%
Drawbox UprRow%, LeftCol%, LwrRow%, RghtCol%
IF UprRow% = UpRow% AND LeftCol% = LtCol% THEN
IF LwrRow% = LoRow% AND RghtCol% = RtCol% THEN
EXIT DO
END IF
END IF
LOOP
Shadow UpRow%, LtCol%, LoRow%, RtCol% '*** now give it a shadow ****
END SUB
SUB Shadow (UpRow%, LtCol%, LoRow%, RtCol%) STATIC
' This routine creates a transparent shadow along the right side
' and bottom edge of the box. Note: Special thanks to John Strong
' for his very helpful tips on what to POKE and where.
'
DEF SEG = &H40
mono% = PEEK(&H10)
IF (mono% AND 48) = 48 THEN
EXIT SUB '*** Forget the shadow if it's monochrome.
ELSE
DEF SEG = &HB800
END IF
... OFFLINE 1.50 "Live long and prosper."
--- MsgToss 2.0d(beta) 12/17/92
* Origin: JW-PC Consulting DataFlex.HST (608)837-1923 (1:121/8)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET