[comp.sys.mac.programmer] Do my modal dialogs get update events

goodill_eric@tandem.com (Eric Goodill) (06/14/91)

Hi,

I've brought up a modal dialog, then I bring up another one in front of it 
partially obscuring the frist dialog.  Then I dismiss the second modal 
dialog which erases part of the first dialog.  The system seems to 
automatically redraw everything except for my user item (a scrolling 
list).  Will I get an update event?  I'm not currently calling 
waitNextEvent because this code is going to end up in a HyperCard XCMD, 
and I don't think I can do that.

I know I can just redraw the user item when I dispose of the second dialog, 
but I'm wondering if there's a more general way to handle this case.

Reply by E-mail, and I'll summarize to the net.

Eric Goodill, goodill_eric@tandem.com, Cupertino, California
"Sucks Syntax"  -- John Haskey

andyp@treehouse.UUCP (Andy Peterman) (06/15/91)

In article <1991Jun14.155015.5817@tandem.com> goodill_eric@tandem.com (Eric Goodill) writes:
>Hi,
>
>I've brought up a modal dialog, then I bring up another one in front of it 
>partially obscuring the frist dialog.  Then I dismiss the second modal 
>dialog which erases part of the first dialog.  The system seems to 
>automatically redraw everything except for my user item (a scrolling 
>list).  Will I get an update event?  I'm not currently calling 
>waitNextEvent because this code is going to end up in a HyperCard XCMD, 
>and I don't think I can do that.
>
>I know I can just redraw the user item when I dispose of the second dialog, 
>but I'm wondering if there's a more general way to handle this case.

You inform the Dialog Manager about a user item's update routine by
calling SetDItem.  For example (in C),

    DialogPtr dialog;
    short type;
    Handle itemHandle;
    Rect rect;

    dialog = NewDialog (...);
    .
    .
    GetDItem (dialog, item, &type, &itemHandle, &rect);
    SetDItem (dialog, item, type, (Handle)UpdateProc, &rect);

The purpose of GetDItem is to return the type and rect used in SetDItem.
UpdateProc is prototyped as:

    pascal void UpdateProc (DialogPtr dialog, short item);

When I've used it, I've never needed the two parameters since it handled
one specific user item.

Hope this helps...

-- 
Andy Peterman                       |  Everything you know 
treehouse!andyp@gvgpsa.gvg.tek.com  |       is wrong! 
(916) 273-4569                      |               FST