Scroll Win in BASIC
Volume Number: 2
Issue Number: 1
Column Tag: Basic School
Scroll that Window in BASIC! 
By Dave Kelly, General Dynamics, MacTutor Editorial Board
One of the problems of using BASIC as a programming language is the inability to
access the Macintosh ROM routines. Many of the toolbox and graphics functions are
built into MSBASIC (2.0 or later) such as MENU, WINDOW, EDIT FIELD, BUTTON which
we have covered in prior issues of MacTutor. This month we will discover the use of
some specialized LIBRARY routines which make use of Macintosh ROM routines which
before this time were only accessible to other programming languages (C, Forth,
68000 Assy., and others).
Fig. 1 Basic Scrolls Windows!
The routines which are featured in this month's column come from Clear Lake
Research of Houston, Texas. It should be noted that the program and discussion which
follows will not work without the Clear Lake Research Libraries. Also the MacTutor
source disk will contain only the listing published here and will not include any of the
CLR routines used by this program listing, since they are obviously a commercial
product for sale. The CLR Libraries are required to run the program. [We encourage
you to obtain these routines (see ad for ordering info or watch the MacTutor mail order
store for this product), since they greatly enhance the power of Microsoft Basic, which
is sadly missing a majority of the toolbox capability. -Ed.]
First a few comments about library routines: In November we discussed the
process of installing BASIC Libraries. Please refer to that issue for information about
installing libraries. It has come to my attention that the ID numbers for some desk
accessories may conflict with the resource ID numbers for libraries even though
resource ID numbers of different types may have the same ID according to Inside
Macintosh. The range of ID numbers should be as follows:
Range Description
-32767 through -16385 Reserved; do not use
-16384 through -1 Used for system resources owned by other system
resources (see IM)
0 through 127 Used for other system resources
128 through 32767 Available for your use in whatever way you wish
Resource ID numbers for desk accessories should be between 12 and 31
inclusive. Therefore, it is advisable that the ID numbers for libraries be assigned to
numbers 128 through 32767. In addition, the CLR Libraries have been assigned
resource ID numbers of 10000 thru about 12000 with a few exceptions. You can be
sure not to have ID numbers that don't conflict with the CLR Libraries if you use ID
20000 through 32767 for your own libraries. This applies to the _Eject routine that
appeared in the November issue. I recommend that the resource ID number for the
libraries be changed as explained above. The _Eject routine works fine in most cases,
but there is a chance that the ID number will conflict with something else.
Please be aware of how to define variables for use in your libraries. For some
reason Integer variables used in Libraries routines should be defined with a %
(following the variable name) instead of using the DEFINT statement. I tried the
statement, DEFINT a-z to define integers throughout the entire program and when a
library routine is executed an error results. You may use DEFINT as long as the name
of the variables used appear later in alphabetical order than the variables defined in
the DEFINT statement. I saw no difference between BASIC 2.0 and BASIC 2.1 as far as