Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!bloom-beacon!BBN.COM!jpool From: jpool@BBN.COM (Jeremy Pool) Newsgroups: comp.windows.x Subject: Accelerators Message-ID: <8905042357.AA04897@expo.lcs.mit.edu> Date: 4 May 89 22:14:08 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 33 A few months back Ralph Swick posted an instructional example of how to use accelerators. The example was a modification to x11r3/examples/Xaw/xboxes.c, and showed how to attach Ctrl-c as an accelerator to the "quit" button of this sample Xaw program. The modification was real simple: Just add: XtInstallAccelerators(toplevel, q); /* q = the quit PushButton */ prior to realizing the widget hierarchy, and adding: Demo*quit.accelerators: Ctrlc: set() notify() to your resources. I have found two problems in trying to repeat, and modify, this example. 1) I was able to get the accelerator to work only if I installed it on the top-most box widget in the widget hierarchy, but not if I installed it on toplevel (as shown) or on the viewport which is toplevel's child and the box widget's parent. I can't figure out any obvious reason for this, as I would have expected the keyboard event to have been passed up the hierarchy, even to toplevel, until it found a widget with a translation for this event. Am I missing something here? 2) An installed accelerator works even when the source widget is insensitive. The Intrinsics documentation doesn't appear to address this issue, but the behavior displayed (at least by the MIT Intrinsics implementation) seems counterintuitive. If a button is insensitive, and therefore not dispatching to action procedures, wouldn't you expect not to be able to dispatch to those same action procedures via an accelerator? Must I put an extra check into all widget action procedures, to check for widget sensitivity? -- Jeremy Pool (jpool@bbn.com)