Custom WDEF and wDraw

Technote TB 05February 1991

Written by: Vincent Lo February 1991

This Technical Note explains why custom window definition functions may not respond to a wDraw message from the system (if you follow the documentation in Inside Macintosh).

Problem & Solution:

Inside Macintosh, Volume I-299, documents the declaration of the window definition function (WDEF) as follows:

    FUNCTION MyWindow(varCode: INTEGER; theWindow: WindowPtr; message:
                      INTEGER; param: LONGINT) : LONGINT;

On the first examination of the parameters, one may assume param always contains a long value; however, when the system is calling the WDEF with message = wDraw, it only stores a short value in param without clearing the high-order word of param. If the high-order word contains any value other than zero, the content of param is different from what the WDEF expects.

For the custom WDEF to work correctly, it should use only the low-order word of param when message = wDraw.

Note: This problem exists in all systems up to and including System Software 7.0. The suggested fix is valid for all of these systems.

Previous Technote | Contents | Next Technote