nick@lfcs.ed.ac.uk (Nick Rothwell) (08/28/89)
I'm writing an application which needs to detect option/click and command/click on the close box of windows. 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; o Disallows command/key short-cut for close (think about it...); o It's a HACK. Advantage: o I don't have to make yet more alterations to my (already much customised) copy of TransSkel. 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? Nick. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk <Atlantic Ocean>!mcvax!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ Fais que ton reve soit plus long que la nuit.
omh@brunix (Owen M. Hartnett) (08/29/89)
Currently, as TransSkel sits, you can't. However, it's fairly easy to modify it so that when it finds a close routine, it sends you back that part of the event which you need to detect it. -Owen Owen Hartnett Brown University Computer Science omh@cs.brown.edu.CSNET
tim@hoptoad.uucp (Tim Maroney) (08/29/89)
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"
nick@lfcs.ed.ac.uk (Nick Rothwell) (08/29/89)
In article <8414@hoptoad.uucp>, tim@hoptoad (Tim Maroney) writes: >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. Ok, point taken, read that as "want". I was under the opinion that Option/Close was a reasonably standard way of closing/hiding all of a set of open windows for an application. I won't mention all the weird option open/close key combinations of the Finder, which is a standard (sic) piece of Macintosh software used by everybody. My idea was to have Option/close as "close all these windows", and Command/close as "close all except this one". The latter is, I admit, rather counter-intuitive, and I may well go for a menu item with key short-cut instead. >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 MicroSoft have no problem with option/shift/"+"/menu item... :-) I have used Word and lived... >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. TransSkel doesn't have MultiFinder support either, but surely that's not because MultiFinder is a non-kosher :-). I sent Paul some MultiFinder support a few months ago. Nor does it have heirarchical menu support (although I don't like heir. menus, so I don't mind). Aren't these just missing features? >(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.) OK, ok, I take the point. I thought that option/close was kosher. I'll get rid of command/close in favour of a menu item "Hide Others". I'm fairly happy with option/close, though, as a special case, because of its presence in the Finder. >>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 tried installing Macsbug from my THINK C release. Couldn't get it to do anything. I've no idea what it can do or how to get it to do it. How's that for "advertising its features"??? :-) >Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Nick. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk <Atlantic Ocean>!mcvax!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ Fais que ton reve soit plus long que la nuit.