C (59/254)

From:Andrew Bell
Date:11 Apr 00 at 00:29:41
Subject:Re: GadTools event loop problem

Hi Donald,

On 10-Apr-00 you wrote: [amiga-c] GadTools event loop problem

> Normally my programs enter a Wait state until a message arrives at
> the window`s message port. When it arrives they get the required
> information out of the message, reply to it and then deal with
> whatever has occurred. How do I code my Wait statement so that it
> waits for an event in more than one window, identifies which window
> the event occurred in and then takes the appropriate action?

Read the autodocs for ModifyIDCMP() and CloseWindow(). These docs
describe how you can run many windows off the one IDCMP message port,
in great detail.

Basically when you create each of your windows, you pass a 0 to the
WA_IDCMP tag, this tell's Intuition not to allocate an IDCMP port for
that particular window. For every window you do this on, you must set
the Window->UserPort to a message port of your own. After creating
each window, use ModifyIDCMP() on each of them to tell Intuition what
messages classes you want to receive.

When an IDCMP message arrives at your port during your event loop, you
can check the IntuiMessage->IDCMPWindow field to determine what
window the message originate from. Once you've found out, you can
examine the message class and check the Gadget ID, etc. as normal.

Before you close any of your "shared" windows, you must reply to all
pending messages for that window and set the Window->UserPort to
NULL. See CloseWindow() for an example.

It's been ages since I've done this, but that's the basic idea behind
multi-window applications.

Regards, Andrew Bell.



+----------------------------------------+
email: mailto:andrew.ab2000@bigfoot.com
web: http://www.andrewb.exl.co.uk
+----------------------------------------+
"Quark to Odo. You still with us?" -- Quark

------------------------------------------------------------------------
Whatever you want, chances are you'll find it at one of the hundreds
of sites in The PointClick Network--like Disney.com, eCost.com,
FogDog.com and many more. You get paid as you shop and an additional
10% off any purchase, anytime.
http://click.egroups.com/1/2994/1/_/451227/_/955468842/
------------------------------------------------------------------------