Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!nsc!pyramid!infmx!robertw From: robertw@informix.com (Robert Weinberg) Newsgroups: comp.sys.mac.hypercard Subject: Re: How to tell when really idle? Message-ID: <1991Apr23.153901.5618@informix.com> Date: 23 Apr 91 15:39:01 GMT References: Sender: news@informix.com (Usenet News) Distribution: comp.sys.mac.hypercard Organization: Informix Software, Inc. Lines: 42 In article kenw@skyler.arc.ab.ca (Ken Wallewein) writes: > > One of the things that's always bugged me about HyperCard is that, >although it updates most stuff to disk automatically, it won't do the same >for the current card -- at least, not doing the things I do. A person can >loose a lot of text in a hurry if you crash without saving first. I think your text will be saved to disk whenever you click out lf the field you are working in. > A while ago I decided to try to address that by writing an idle handler >that would detect how long HyperCard had been sitting idle, and if it was >longer than, say, five minutes, it would execute a "keep" (custom, of >course). > > I discovered that there appears to be no reasonable way to tell how long >HyperCard has been "consecutively" idle. Oh, sure, one can count "idle" >messages. Unfortunately, one needs a way to _reset_ that counter if >_anything_ _else_ happens. Oops. About the only way to address this right >now, as far as I can see, is to set up handlers for all the system >messages, and have them all clear a global variable. I don't like the >overhead, and it's not foolproof. > > Does anybody have a better way to address this problem? How about an idle handler that just checks the number of ticks since the last time it was invoked? Like: "if the ticks - SavedTicks > whatever, then IdleWasInterrupted; put the ticks into SavedTicks." You can figure out how long the handler takes, and determine the proper constant to let you know if something else has happened between invocations of your handler. Then you need to handle IdleWasInterrupted with something like: "if the ticks - SavedInterrupt > fiveMinutesWorth then KeepHandler; put the ticksinto SavedInterrupt." Well, just a thought. -- * Rob Weinberg, graphics & publishing ***** Does a falling tree make a sound * * {uunet,pyramid}!infmx!robertw ***** if 1: no one hears it * * => Ask me about me. ***** BUT 2: it is not known that * * => Ask Informix about Informix. ***** no one hears it? *