Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: How to detect Option/Close under TransSkel? Message-ID: <8414@hoptoad.uucp> Date: 29 Aug 89 06:31:29 GMT References: <253@castle.ed.ac.uk> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 61 In article <253@castle.ed.ac.uk> nick@lfcs.ed.ac.uk (Nick Rothwell) writes: >I'm writing an application which needs to detect option/click and >command/click on the close box of windows. This is clearly some meaning of "need" with which I am not familiar. >Unfortunately, TransSkel >(which I'm using) doesn't deliver the event modifiers to me, but only >the close event. I'm currently using a hack: after getting the close >event, look at the key-map to see if the option/command keys are down. > Disadvantages: > o Hard-wired key numbers which may not be universal between machines; Could be, but so much software uses the modifier keys and GetKeys that it's awfully unlikely to change. Still, better safe than screwed. > o Disallows command/key short-cut for close (think about it...); Only if you use the Command key for something it's not intended for. > o It's a HACK. So is hiding features of your program in obscure command and option key combinations. The best thing about the Mac interface is that software advertises its features. It should advertise *all* its features; on other computers, you can get away with saying "you insert the date by typing 'date', setting the mark to the front of the word, and pressing cokebottle-delete to turn it into an internal variable reference". Many people still try this kind of crap on the Mac, and it leads to bad interfaces. Put whatever special function it is you want in the menus or in a button. Hidden features -- just say no. You forgot a disadvantage -- the key may already be up by the time you check it. So this method is not reliable. > Advantage: > o I don't have to make yet more alterations to my (already much > customised) copy of TransSkel. I'm not familiar with TransSkel (no FTP access) but I have a certain amount of respect for DuBois as a programmer (if not as a theologian). The reason he doesn't give you the modifier flag here is because this kind of interfacing is anything but kosher. (And yes, I know all about the Finder's option-close feature; it's one of the many serious mistakes made in the Finder's interface. You should all know by now that applications from Apple are generally among the most confusing and least standard.) >I suspect that altering TransSkel yet again is the only true option. >Just out of curiosity, how does MultiFinder detect Option when opening >DAs in the application partition? Might it be this self same hack? Why not say "atb getkeys" in Macsbug and find out? I just did. The answer is yes. And hack is the word. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "As I was walking among the fires of Hell, delighted with the enjoyments of Genius; which to Angels look like torment and insanity. I collected some of their Proverbs..." - Blake, "The Marriage of Heaven and Hell"