ResourcesZBas 4.0
Volume Number: 3
Issue Number: 8
Column Tag: Basic School
Using Resources with ZBASIC 4.0 
By Dave Kelly, MacTutor Editorial Board
This is the anniversary of Basic Wars which began a year ago. This time there is
a real winner! After a lot of struggle it appears that ZBasic™ has now come out on top.
Version 4.0 is now available. If nothing has broken between what I’ve seen and the
final release, ZBASIC ™ should be 99% free of problems (famous last words). The
program at the end of this months column was written using version 3.85 beta which
is supposed to be like version 4.0 except without the new editor. Even without the
editor, I am extremely excited about ZBasic™ now (NO MORE BOMBS!!!).
Enhancements to ZBASIC ™ before version 4.0 are:
• NEW MANUAL: 206 pages dedicated to just the Macintosh, including many many
examples.
• TOOLBOX supported: documentation is now provided to use toolbox commands at
will.
• NEW COMMANDS such as TEHANDLE, SELECT CASE, GET WINDOW, HANDSHAKE,
SHUTDOWN, FLUSHEVENTS.
Ok, enough of that. The real reason we are here is to discover how to program in
Basic. If you have been watching this column over the past several months you will see
that there have been things I’ve wanted to do with Basic that was not supported by any
version of Basic. In addition, we have received many letters from frustrated readers
trying to use Basic to do things that should have been easy but not supported. I’ll
attempt to patch the holes in the past columns by showing you how in the ‘new’ ZBASIC
.
Michael Crichton Reads MacTutor
One letter I received recently was from a fellow author, Michael Crichton. For
those of you that don’t know him, he was author of the book, “The Andromeda Strain”
and has just released a new book, “SPHERE” (How’s that for a plug for your new book,
Michael?). Anyway, in his letter, he indicated that he wants “to manipulate text
strings as a resource in a compiled ZBasic program”. The basic theme of this month’s
column is “Using Resources with ZBasic”.
The idea that I will show is to use a string resource of type ‘STR ‘ to store data
that is to be used by the application the next time that it is run. In this case, I will
store the current font and size in the string resource. The other half of this column
finishes up what got started in the past several columns. If you remember, I attempted
to read the font names from the system file and install them into a Font menu. With
PCMacBasic it was determined that even though you could use the ADDRESMENU toolbox
call and create the menu, PCMacBasic would not let you access any new menus. UGH!
Then there was MS Basic which let you read the font resources through library calls
(though a roundabout way), but would only let you have 20 items in a menu. Since
many of you have hard disks and want more than 20 fonts, that limited your programs
to those fonts that you could fit. Even previous versions of ZBasic had problems, but
since it works now and I can’t remember exactly the problem (probably a bomb!) we
won’t discuss it.
Fig. 1 A Font and Size menu that really works in Basic!
Font Menu That Works