Article View: comp.sys.amiga.tech
Article #11228Re: inputs from many windows.
From: Ross Cunniff
Date: Sun, 29 Jan 1989 05:53
Date: Sun, 29 Jan 1989 05:53
38 lines
1866 bytes
1866 bytes
In article <1918@pur-phy> tlm@pur-phy (Timothy Lee Meisenheimer) writes:
> Well, I'm working on a little project which will have lots of little
> windows around (1 - X where X is related to how obnoxious you're feeling)
> and I'll be getting inputs (mouseclicks, gadgets, kill etc.) from them
> all...
> ...what have you done in your event loop to read
> all these messages and tell which window they come from?
Well, probably the best thing is to share the same IDCMP port between
all your windows. To do this, first get an IDCMP (from the first OpenWindow
will do nicely). When you open subsequent windows, don't specify ANY
IDCMP events in the NewWindow structure. Instead, do the following:
Win = OpenWindow( &NewWin );
Win->UserPort = OrigWin->UserPort;
ModifyIDCMP( Win, MOUSEBUTTONS|MOUSEMOVE|... (whatever) );
You now are sharing the same IDCMP between OrigWin and Win. You
can tell which window an event came from by examining the Msg->IDCMPWindow
field. BE CAREFUL, however, when you close Win. You will have to do something
like the following, or you may get gurus:
ILock = LockIBase( 0 );
while( Msg = GetMsg( Win->UserPort ) ) {
ReplyMsg( Msg );
}
Win->UserPort = NULL;
CloseWindow( Win );
UnlockIBase( ILock );
(Your mileage on actual code may vary. Amiga Wizards???)
Ross Cunniff
Hewlett-Packard Colorado Languages Lab
...{ucbvax,hplabs}!hpfcrt!cunniff
cunniff%hpfcrt@hplabs.ARPA
Technical Details
Message-ID:
<11640009@hpfcdc.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!ucbvax!hplabs!hpfcdc!cunniffReferences:
<1918@pur-phy>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!ucbvax!hplabs!hpfcdc!cunniff From: cunniff@hpfcdc.HP.COM (Ross Cunniff) Newsgroups: comp.sys.amiga.tech Subject: Re: inputs from many windows. Message-ID: <11640009@hpfcdc.HP.COM> Date: 29 Jan 89 05:53:02 GMT References: <1918@pur-phy> Organization: HP Ft. Collins, Co. Lines: 38