EYRING@cc.utah.edu (05/15/91)
Keyboard Accelerators in OpenLook 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. For every mouse event, they have a keyboard accelerator available. You don't have to memorize them or keep your WordPerfect keyboard template available. Windows 3.0 uses an underline "_" below the accelerator key. When that item shows up in a menu, you use the "ALT" "under- lined character" sequence. This is really nice, since it does not clutter up the menus with additional symbols. Just a simple underline. How can I accomplish this in OpenLook. Apparently they have made this difficult with changing the text from the default in buttons. I can understand their reasons, but I really want to do this. I've tried embedded backspaces with underlines in the button definition strings. Nothing. Any ideas? >Bob Witmer >Eyring Inc., Flight Simulation Division >Salt Lake City, Utah >rcw%eyring.uucp@snowbird.sun.com
openlook-request@openlook (05/21/91)
> 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. The following doesn't answer your question, because you asked about XView. Still, for those who are using OLIT.... In OpenWindows 2.5 the OPEN LOOK Intrinsics Toolkit (OLIT) supports ``accelerators'' and ``mnemonics''. The latter are what the person quoted above is asking for--mnemonics are shown as a single underlined character of the control's label (or a letter in parentheses if the mnemonic isn't in the label). Pressing ALT+menmonic activates the control as if SELECT was clicked on the control. Accelerators are similar, but (1) are a client-supplied arbitrary key sequence (e.g. Alt-Ctrl-m), and (2) are shown to the right of the label, in a human-readable form of the modified keystroke (Alt+Ctrl+m in this example). One other difference: Accelerators are global to a client (no two controls can have the same accelarator), while mnemonics are local to a shell window. One specifies a mnemonic with the XtNmnemonic resource, an accelerator with the XtNaccelerator resource. The value of the first should be a single character (don't include the ALT), the value of the second should be a single key-event, as in this example: Alt Ctrl <m> Steve Humphrey UNIX System Laboratories
jarober@aplcen.apl.jhu.edu (DE Robertson james an 740-9172) (05/22/91)
In article <a2ft451@openlook.Unify.Com> 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