Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!umvlsi!dime!dime.cs.umass.edu!nayeri From: nayeri@cs.umass.edu (Farshad Nayeri) Newsgroups: comp.sys.mac.hypercard Subject: Re: Trapping out Command-Period key presses. Message-ID: Date: 12 Sep 90 23:25:15 GMT References: <7433@milton.u.washington.edu> Sender: news@dime.cs.umass.edu Reply-To: nayeri@cs.umass.edu Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst) Lines: 51 In-reply-to: bjornl@milton.u.washington.edu's message of 12 Sep 90 21:08:37 GMT In article <7433@milton.u.washington.edu> bjornl@milton.u.washington.edu (Bjorn Levidow) writes: Does anybody know how to trap out Command-Period key presses by the users? I have a stack where I want the user to do more than browse, so I can't have the stack locked, but I don't want them to be able to interrupt a script in the middle of execution. Putting a trap in an idle handler could be done, but it would be cumbersome in my situation. Any elegant solutions? Thanks in advance. I don't think there is anyway to do this directly from Hypertalk. I do have a workaround that is not very elegant IMHO, but gets the job done using only Hypertalk. I found out that usually cancelations involved breaking out of a loop, so I wrote the following workaround: -- notice the code is written on the fly -- syntax might be wrong, but the idea is there put the msg into msgBack -- ATP: what is the right way to use the message box anyway? on viewAllCards repeat for i = 1 to number of cds if the mouse is down then exit repeat -- also you can call handler put "visiting card"&&i&". [Hold mouse button down to cancel.]" go to cd i end repeat end viewAllCards put msgBack hide msg It works. I am not sure if the ATP would approve it though (I kind of doubt it...) A better way is to use a non-modal dialog box (I originally thought ShowDialog XCMD stack includes non-modal dialogs, but as far as I can see it doesn't [Jay Hodgden, are you there?]) with Cancel button on it. Kind of like the way the old Print... command use to work on System version 4.0-. As far as command-period discussion goes, I am not sure if it is even wise to tell the novice user about command-period. That way they can break out of very important scripts while they are running (for example openCard, etc...) and weird things may happen to them. Note to people who have seen 2.0: is this problem fixed? -- Farshad Nayeri Object Oriented Systems Group nayeri@cs.umass.edu Dept. of Computer and Information Science (413)545-0256 University of Massachusetts at Amherst