[comp.sys.mac.programmer] ResEdit behaving strangely with custom WDEF

pettinati_f@apollo.COM (Fabio Pettinati) (06/02/89)

I have written a custom WDEF that implements a Motif-like window (3d-like,
shaded frames), with raised buttons for close and zoom boxes, drag bar and
grow corners and edges. The WDEF was written in C with MPW 3.0 on a Mac-II
running Multfinder.

I followed the guidelines in IM-I and IM-V:
      .
      .
      .
    - Use SysEnvirons to check for color quickdraw
    - If in color:
        . call GetCWMgrPort (...) to get the color port CWMgrPort
        . synchronize CWMgrPort with the current port (WMgrPort)
        . set port to CWMgrPort
    - Allocate dataHandle and manually set adequate values into
      (*theWindow->dataHandle)->windowState.stdState
    - locked and unlocked all handles properly
      .
      .
      .

To test I pasted the WDEF in a couple of applications (copies :-)): MacWrite,
MacDraw, sample applications from Apple's DTS, and PixelPaint. With the
exception of PixelPaint, which refused to display the window and its contents,
it worked w/o problems.

The real problem appeared when I pasted the WDEF into a copy of ResEdit 1.2b2.
The following things happen:

    1. ResEdit's main window is displayed with a go away box. I checked the
       window's goAwayFlag, and it is TRUE. Well, with the standard WDEF, no
       go away box is displayed; why this strange behavior? If I hit the go away
       box, the window closes, the desktop icons disappear, the disk spins a lot,
       and then (ta-da) the window reappears. To make sure I was not seeing things
       (and I tell you, working in my basement at 1:00AM makes you see lots of
       things...) I even pasted WDEFs from SADE and MacProject II. The one from
       Sade had no go away box; the one from MacProject (a floating palette) had
       a go away box!

    2. When editing a WIND resource that utilizes the new WDEF, ResEdit is unable
       to display the scaled-down window image properly: the frame, buttons and
       title are not displayed, only the contRgn is surrounded by the dotted
       rectangle. This happens only if I set the port to CWMgrPort in the WDEF.
       Not only that but when I reach for the menu bar, selections can be made,
       but the pull-down menus don't get displayed. All these symptoms go away if
       I don't use CWMgrPort (which means that in a Mac-II I cannot take full
       advantage of color).

Since Apple-brand WDEFs, which are 'universal', don't exhibit these symptoms, either
I messed up (probably :-)) or have encountered some undocumented feature. I would
appreciate to receive some input on these problems.

Thanks,

Fabio Pettinati

email: pettinati_f@apollo.com
phone: (508)256-6600 x5760