Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!jarober From: jarober@aplcen.apl.jhu.edu (DE Robertson james an 740-9172) Newsgroups: comp.windows.open-look Subject: Re: Key accelerators in Opeook ? Message-ID: <1991May21.233321.20918@aplcen.apl.jhu.edu> Date: 21 May 91 23:33:21 GMT References: Reply-To: jarober@aplcen (DE Robertson james an 740-9172) Organization: Johns Hopkins University Lines: 35 In article writes: >> I am currently designing an application with XView. I have worked with the >> Mac and Windows 3.0 GUIs, but I really like the way Windows 3.0 supports >> keyboard accelerators. >> ... >> How can I accomplish this in OpenLook. Well, I don't know how to get Mnemonics like Windows has, but you can get key equivalents. First, make sure the control area that contains your buttons (or various other controls) has an event handler named on the property sheet. Second, click on the keys you want to use - Primary (Ascii), Top, Right, Left. Also make sure to ask for mouse enter and exit events ! Next, generate you guide code. Edit the stubs file with Your Favorite Editor, and go to the event handler you specified. Use a code segment like the following: switch (event_id(event)) { case LOC_WINENTER: win_kbd_focus(display, win); break; case TOP_KEY(10): /* assuming you want TOP(10) */ do_something(); break; default: break; } I'm not quite sure about the win_kbd_focus() call... I'm working from memory and that's close to the correct function name. It's in the O'Reilly book though. I just got through doing this myself, and have gotten it to work. If you still can't get it to work, send me email, and I'll have a code sample for you. Hope this helps ! James A. Robertson jarober@aplcen.apl.edu