Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!oliveb!amdahl!JUTS!duts!gjf00 From: gjf00@duts.ccc.amdahl.com (Gordon Freedman) Newsgroups: comp.windows.x.motif Subject: Need help with accelerator(s) Message-ID: <4f1702Em06cB01@JUTS.ccc.amdahl.com> Date: 28 Mar 91 02:19:39 GMT Sender: netnews@ccc.amdahl.com Reply-To: gjf00@DUTS.ccc.amdahl.com (Gordon Freedman) Organization: Amdahl Corporation, Sunnyvale CA Lines: 63 I am trying to use accelerators in my Motif application and cannot get them to work at all. I'm running ICS-motif version 1.1 on a Sun Sparc with MIT X11R4. I am trying to define accelerators for the function keys on the Sun keyboard. I have successfully installed translations for them within a specific widget from the resource file: *memAddrLogical*translations: #override\n\ Return: memAddrReturn()\n\ osfRight: memAddrRight()\n\ osfLeft: memAddrLeft()\n\ osfBackSpace: memAddrLeft()\n\ F1:memAddrInit(00000000)\ memAddrDisp()\n\ F3:memAddrInit(0000f000)\ memAddrStack(00000020)\ : memAddrKey()\n\ ,:extend-adjust()\n\ ,:memAddrPaste() This works as advertised, although the user has to have the mouse pointer in the memAddrLogical widget for the F1 and F3 keys to take effect. I want to set things up so the user can enter these keys from anywhere in the window. The Motif programmer's reference indicates that widgets with translations in them will not propogate accelerators, so I took all of the translations out of my widgets, and put them into an accelerator resource for the text widget. I seem to remember hearing somewhere that acclerators only work for buttons, so I also tried setting the accelerator resource for a button which was not managed. Neither of these worked at all, I was not getting into the action routines, and it appeared that the acclerator events were being ignored. I even tried managing the button, to no avail. I am doing an XtInstallAllAccelerators (memBigForm, memBigForm), where memBigForm is near the top of the widget heierarchy, and both the unmanaged button and the text widget are descendants of memBigForm. I then put the following in my resource file (and removed memAddrLogical*translations): *memAddrLogical*accelerators: #override\n\ Return: memAddrReturn()\n\ osfRight: memAddrRight()\n\ osfLeft: memAddrLeft()\n\ osfBackSpace: memAddrLeft()\n\ F1:memAddrInit(00000000)\ memAddrDisp()\n\ F3:memAddrInit(0000f000)\ memAddrStack(00000020)\ : memAddrKey()\n\ ,:extend-adjust()\n\ ,:memAddrPaste() This doesn't work, nor does specifying the same thing for the accelerators resource for the button. I have been able to successfully use the accelerator (no s) resource for pushbuttons, so it looks like the XtInstallAllAccelerators works. I've also gotten accelerators to work in an Xt application once before, so I'm reasonably sure I'm doing it right. Any help would be much appreciated. -- Gordon Freedman: gjf00@duts.ccc.amdahl.com Disclaimer: My opinions! Not my employers!