Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!jk3t+ From: jk3t+@andrew.cmu.edu (Jonathan King) Newsgroups: comp.sys.mac.hypercard Subject: Re: Question about protocol for trapping menu items. Message-ID: Date: 24 Jan 91 07:19:42 GMT References: <1991Jan23.234729.7744@world.std.com> Organization: Psychology, Carnegie Mellon, Pittsburgh, PA Lines: 39 In-Reply-To: <1991Jan23.234729.7744@world.std.com> ralph@world.std.com (Ralph Lombreglia) writes: > However, I can't seem to figure out how to make > the handler restore the palettes after the compaction. I'm sure > there's a simple answer, but I'm stumped. Why does the following > *not* work? > > on doMenu what > if what is "Compact Stack" then > close window "MyPalette" > pass doMenu ^^^^ ^^^^^^ > palette "MyPalette", "345,80" > else pass doMenu > end doMenu Your problem is this: the keyword "pass", in addition to passing a message along the message path *immediately stops execution of the handler*. So, in this case, your palette command never executes. Note that the obvious workaround, replacing "pass domenu" with "domenu Compact Stack" could make your handler trip over itself. Using 'send "domenu Compact Stack" to Hypercard' will probably work, but it facistically bypasses any other handlers on the way that want to prepare for stack compaction. About the best you can do here, it would seem, is to send the "domenu" one notch higher along the message path. So, if this handler were on a card, it would read: on doMenu what if what is "Compact Stack" then close window "MyPalette" send "domenu Compact Stack" to this background palette "MyPalette", "345,80" else pass doMenu end doMenu > Thanks. Hope this works... jking