Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!unmvax!indri!uflorida!haven!umd5!zben From: zben@umd5.umd.edu (Ben Cranston) Newsgroups: comp.sys.mac.programmer Subject: Re: Who has hacked numeric TEdit?. Summary: The Mac way of doing this Message-ID: <4964@umd5.umd.edu> Date: 2 Jun 89 18:50:34 GMT References: <1076@mailrus.cc.umich.edu> <11722@well.UUCP> <16413@paris.ics.uci.edu> Reply-To: zben@umd5.umd.edu (Ben Cranston) Distribution: na Organization: University of Maryland, College Park Lines: 49 In article <16413@paris.ics.uci.edu> Alastair Milne writes: > odawa@well.UUCP (Michael Odawa) writes >> In article <1076@mailrus.cc.umich.edu> cash@csmil.umich.edu (Howard Cash) writes: >>> Who is willing to part with the code for an editable text item >>> that only accepts valid numbers (real or integer)? >> You can intercept the keystrokes in the FilterProc you call with >> ModalDialog. Then peek at every key event as it comes in. If it's not >> a digit, change the event into a nullEvent and mark it as handled: > ... the user has no way of knowing why his keystrokes aren't registering. > There is nothing here to alert the user that only digits > (and signs, and ".", etc.) are to be used. I think an alert is necessary... The Macintosh way of doing this would be to use staged alerts. For the first few bad keystrokes one would just beep. This is a cognitively cheap way to remind a knowlegable but confused user that he is doing something wrong. We let a few go by with beeps because it takes awhile to interrupt his keying and get his attention. He looks at the situation afresh, realizes he is in a numeric-only context, and proceeds to enter the CORRECT data. For the novice we set the last stage to be a fully-blown alert, which explains in excruciating detail (:-) just what is going on. Actually I really dislike being interrupted by alerts that are not any fault of my own, like SFPutFile DRIVE-ing into a write-inhibited volume. I would MUCH rather some indicator that does not need an explicit mouse click or CR on my part to dismiss. My personal suggestion would be a blinking line of text in the window, saying "write-inhibited disk" or something. The analogy with the above would be a blinking "please enter a number" or some such rot. If you think this intrusive, have it appear (or START blinking) on the first bad keystroke given. > Now for the nasty part. I assuming we've been thinking so far about the > entry of integers. What about real numbers? I may just have missed it, but > I don't recall seeing any standards in I-M for real number format (beyond > the settings of components that differ between countries.) Having worked > on CAI material for some years, where such entry has to be made very > tolerant for students who've never used a computer before, I can attest the > number of difficulties to consider. Are there any standards for this? Check the Apple Numerics (?) manual. If there isn't something in there, there should be (are we listening, Apple?). There is an internationalization issue here too, and I think this is an area in which Apple could profitably standardize... I'm a systems programmer. We don't do floating point... :-) -- Ben Cranston (Kingdom of Merryland UniSys 1100/92) Copyright 1989 (you may redistribute ONLY if your recipients can).