home *** CD-ROM | disk | FTP | other *** search
- '****************************************************************************
- 'Total Control Systems QuickBasic 4.5
- '****************************************************************************
- '
- ' Program : DISPMSG.BAS
- ' Written by : Tim Beck
- ' Written On : 10-01-90
- ' Function : DISPLAY MESSAGE SUBROUTINE
- '
- '****************************************************************************
- ' This program and those associated with it were written for use with Quick-
- ' Windows Advanced (Version 1.5+). Possesion of this program entitles you
- ' to certain priviliges. They are:
- '
- ' 1. You may compile, use, or modify this program in any way you choose
- ' provided you do not sell or give away the source code to this prog-
- ' ram or any of it's companions to anyone for any reason. You may,
- ' however, sell the resulting executable program as you see fit.
- '
- ' 2. You may modify, enhance or change these programs as you see fit. I
- ' as that you keep a copy of the original code and that you notify
- ' me of any improvements you make. I like to think that the code is
- ' bug free and cannot be improved upon, but I'm sure someone will
- ' find a way to make it better. If it's you, I'm looking forward to
- ' seeing your changes. I can be reached at:
- '
- ' Tim Beck Tim Beck (C/O Debbie Beck)
- ' 19419 Franz Road 8030 Fairchild Avenue
- ' Houston, Texas 77084 Canoga Park, California 91306
- ' (713) 639-3079 (818) 998-0588
- '
- ' 3. This code has been tested and re-tested in a variety of applications
- ' and although I have not found any bugs, doesn't mean none exist. So,
- ' this program along with it's companions comes with NO WARRANTY,
- ' either expressed or implied. I'm sorry if there are problems, but
- ' I can't be responsible for your work. I've tried to provide a safe
- ' and efficient programming enviroment and I hope you find it helpful
- ' for you. I do, however, need to cover my butt!
- '
- ' I have enjoyed creating this library of programs and have found them to be
- ' a great time saver. I hope you agree.
- '
- ' Tim Beck //
- '
- '****************************************************************************
- DECLARE SUB CLOSE.WINDOW (wid%)
- DECLARE SUB MAXWID (M.Item%, msg$(), max.wid%)
- DECLARE FUNCTION FreeWind% ()
- DECLARE FUNCTION Show$ (Show.String$, Show.Len%)
-
- DECLARE SUB DISPLAY.MSG (Row%, Col%, items%, msg$(), Hdr$, Get.Item%, selected%, flag%)
-
- '------------------------------------------------------------------------
- ' Display a Message at a specified position on the Screen
- ' Optionally get a response from the Message
- '
- ' Row%, Col% = Top Left Row and Column of Message Box
- ' items% = Number of Items (Message Lines)
- ' msg$() = Message Lines
- ' Hdr$ = Message Box Header
- ' Get.Item% = Get Item or Display Message Flag (0 = Display Message only)
- ' selected% = Number of Item Selected
- ' Flag% = Error Flag%
- '
-
- REM $INCLUDE: 'STDCOM.INC'
-
- TIMER OFF 'Enables Event Trapping
-
- ' ON ERROR GOTO ErrorTrap
-
- ErrorTrap:
-
- ' RESUME
-
- SUB DISPLAY.MSG (Row%, Col%, items%, msg$(), Hdr$, Get.Item%, selected%, flag%) STATIC
-
- flag% = 1
-
- Style% = Sh.Flag% + EX.Flag%
-
- IF Row% = 0 THEN
- Row% = 1
- END IF
- IF Col% = 0 THEN
- Col% = 1
- END IF
- IF selected% = 0 THEN
- selected% = 1
- END IF
-
- wid% = FreeWind%
- sav% = wid% 'In case of error, wid% will be returned
- 'negative, sav restores original value
- idx% = ((wid% - 1) * 2000) 'each window is allotted 2000 characters
-
- CALL MAXWID(items%, msg$(), max.wid%)
- IF Get.Item% = 0 THEN
- msg$ = ""
- FOR M% = 0 TO items% - 1
- msg$ = msg$ + " " + Show$(msg$(M%), max.wid%)
- IF M% < items% THEN
- msg$ = msg$ + "~"
- END IF
- NEXT M%
- CALL MESSAGEBOX(" OK ", 17, S.attr%, msg$, items%, max.wid% + 2, S.attr%, selected%, msg.array%())
- ELSE
- IF items% < 10 THEN
- hgt% = items%
- ELSE
- hgt% = 10
- END IF
- CALL WOPENI(Col%, Row%, Col% + max.wid% + 3, Row% + hgt% + 1, Style%, S.attr%, Hdr$, w.array%(), idx%, wid%)
- IF wid% <= 0 THEN
- wid% = sav%
- END IF
- CALL POPMENUV(wid%, 0, 0, max.wid% + 2, hgt%, S.attr%, S.attr%, selected%, items%, 2, kb%, flag%, msg$())
- CALL CLOSE.WINDOW(wid%)
- END IF
-
- END SUB
-
-