[comp.sys.apple] IIGS programming question

hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) (06/22/89)

Another question about IIGS toolbox programming:  In a program I'm writing
I have a small window that opens and then closes again as soon as the user
presses the mouse button (anywhere on the screen).  (By the way, I don't
want to use a dialog box for this purpose.)  That part works fine, but when
the program gets back to the main event loop it interprets that mouse press
as part of the event queue and acts accordingly, which I don't want.  What I
want it to do is use that mouse press to close the window, and then NOT add
it to the event queue.  Is there some way to do this?  Thanks a lot.

Jeff Hartkopf

Internet:
hartkopf@tramp.Colorado.EDU

dlyons@Apple.COM (David Lyons) (06/22/89)

In article <9607@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) writes:
>[...] when
>the program gets back to the main event loop it interprets that mouse press
>as part of the event queue and acts accordingly, which I don't want.  What I
>want it to do is use that mouse press to close the window, and then NOT add
>it to the event queue.  Is there some way to do this?  Thanks a lot.

You can't stop the mouseDown event from being added to the queue, but you
can certainly *use* it from the queue--this is probably the most reasonable
thing to do.  I guess you're just calling Button(0) right now to check the
button status.  Instead, call GetNextEvent (with a pointer to some space to
use as the event record) until it returns a mouseDown event.  Using $ffff
for the event mask is probably fine--if you mask out other events, they will
be saved up & used later (you probably don't want keypresses that come along
to be kept and used later, so just ask for all events & ignore the ones you
don't want).

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

jazzman@claris.com (Sydney R. Polk) (06/24/89)

From article <9607@boulder.Colorado.EDU>, by hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M):
> 
> Another question about IIGS toolbox programming:  In a program I'm writing
> I have a small window that opens and then closes again as soon as the user
> presses the mouse button (anywhere on the screen).  (By the way, I don't
> want to use a dialog box for this purpose.)  That part works fine, but when
> the program gets back to the main event loop it interprets that mouse press
> as part of the event queue and acts accordingly, which I don't want.  What I
> want it to do is use that mouse press to close the window, and then NOT add
> it to the event queue.  Is there some way to do this?  Thanks a lot.

You mean you are not using the event to draw the window?  What are you doing,
itercepting mouse interrupts directly?

If you draw when you get the event, then this problem should go away, no?

-- 
Syd Polk           | Wherever you go, there you are.
jazzman@claris.com | Let the music be your light.
GO 'STROS!         | These opinions are mine.  Any resemblence to other
GO RICE!           |  opinions, real or fictitious, is purely coincidence.