July 90 - Apple II Q&A
July 90 - Apple II Q&A
APPLE II DEVELOPER TECHNICAL SUPPORT
Q In the previous issue of d e v e l o p , an answer said that anyone doing a Close with reference number zero
will close New Desk Accessory resource forks. Does this mean my NDA can't use resources?
A No. It means that your NDA can't open its resource fork at DAInit time and expect it to always be
open. You can use resources in an NDA by opening the resource fork when your DA is opened and
closing it when your DA is closed. Although an application could still close your resource fork while
your DA window is open but
not active, this is not likely.
Q Matt, I found your caching article to be very informative, but I'm confused about the driver level of caching.
You say that if the cachePriority word on GS/OS direct page is zero, the driver should not write the block to
the cache. If the block was already in the cache, won't this mean the disk has a different block than is in the
cache, messing things up drastically?
A Thanks, and yes. When a driver is supposed to ignore the cache on a write call (because the
cachePriority field is zero), it still must deal with the possibility that the block may already be in the
cache. When writing with cachePriority zero, drivers may not add new blocks to the cache but must
update blocks that are already in the cache. This step is necessary because the next time someone reads with caching enabled, the block in the cache will be returned. Next
time I forget something, I promise that it will be
less important.
Q I did a SelectMember2 on an extended list control, and the list was drawn at a funny place in my window.
What gives?
A The current port was not set to the window that the list control was in. Most List Manager calls, and
many other toolbox calls, require that the current grafPort be explicitly set. Before you call
SelectMember2, set the current port to your window with a SetPort call. Remember the note in theApple IIGS Toolbox Reference, volume 2, under the NewWindow call-- "Important: NewWindow does
not set the current port, but many routines require that a current port exist. Use the QuickDraw II
routine SetPort to set the current port." Using SetPort can prevent toolbox confusion and reduce
your debugging time.
Q Someone told me that there's an easier way of keeping track of double and triple clicks in System Software 5.0
and later. What is it?
A The extended Task Record introduced in System Software 5.0 includes a new field called
wmClickCount, at offset $1C. If you're using TaskMaster in
your application, set bit 19 of your wmtaskMask (the tmMultiClick bit) and TaskMaster will keep the
wmClickCount field updated. Every time there is a mouse-down event within the limits set by the
user in the control panel setting 'Double Click', TaskMaster will increment wmClickCount by 1. If
you're interested in double or triple clicks, check wmClickCount on every mouse-down-related event.
If it's at 2, then
a double click was the last mouse-down result, three, it was a triple click. In fact, you can track as
many closely spaced clicks as you like--quintuple, sextuple, on up--if you really want to get silly.
Apple recommends not going further than triple-clicking since more clicks become quite unwieldy.
Q What the heck is the resource ID for a control color table, and why is it so hard to find in the Types.Rez
interface file?
A The resource ID for control color tables is $800D, and is referenced in Types.Rez as resource name
r_BBBB. It is listed under its regular name (rCtlColorTable) in Appendix E of the Apple IIGS Toolbox
Reference, volume 3. The obscure name in Types.Rez and the lack of a resource structure either in
Types.Rez or Appendix E is caused by the structure being variable, depending on the control type
associated with the color table.
Q ACE compression and expansion don't work consistently for me. I can compress (or expand) one sound correctly,
but the next time I try it the results are all wrong. What gives?
A You forgot to call ACECompBegin or ACEExpBegin between different compressions or expansions.
ACE maintains information on the current operation in its direct page space to allow you to do
multipart expansions or compressions. When you start working with a new sound sample, you have
to call either ACECompBegin or ACEExpBegin to inform ACE that you're starting a new
operation, and all the internal data should be reset. More information can be found in the ACE
chapter of the Apple IIGS Toolbox Reference, volume 3.
Q Do I need to purchase APW Tools & Interfaces if I already bought Programming Tools & Interfaces for APW?
A Yes! The original Programming Tools & Interfaces utilities did not correctly support ORCA/Pascal
and ORCA/C. Also, every tool in the package has been updated and enhanced. A new C library,
used to build some of the tools, had bugs fixed in it (and will be available separately later). The new
package also includes completely revised Apple II GS interfaces for APW C and the APW/ORCA
assembler. The new APW Tools & Interfaces package is a class 1 product that may be ordered from
Developer Tools Express; the previous class 2 product is no longer supported.
These questions and answers are compiled by the Apple II Developer Technical Support group. *