📄 67178
字号:
Xref: cantaloupe.srv.cs.cmu.edu comp.windows.x:67178 comp.windows.x.motif:16724Newsgroups: mlists.motif-talk,comp.windows.x,comp.windows.x.motifPath: cantaloupe.srv.cs.cmu.edu!magnesium.club.cc.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!telesoft!trevorFrom: trevor@telesoft.com (Trevor Bourget @ignite)Subject: Re: REPOST: Accelerators/TranslationsMessage-ID: <1993Apr22.162016.5923@telesoft.com>Keywords: Accelerator, caseOrganization: Alsys Group, San Diego, CA, USAReferences: <sdennis.735423404@aa.cad.slb.com>Date: Thu, 22 Apr 1993 16:20:16 GMTLines: 75In <sdennis.735423404@aa.cad.slb.com> sdennis@osf.org writes:>I posted this a while ago and didn't receive one reply, and now we>have another bug report on the same subject. Can anybody help me out?The problem is that Motif uses XGrabKey to implement menu accelerators,and these grabs are specific about which modifiers apply. Unfortunately,the specification for XGrabKey doesn't allow AnyModifier to be combinedwith other modifiers, which is exactly what would be desired in this case:"Ctrl Any<Key>q".>In ORA Vol. 6, in the section on accelerators it says "For information>on how to specify translation tables see Vol. 4...", this is so you>know what to put for the XmNaccelerator resource. If you go to>Vol. 4 it says, "Likewise, if a modifier is specified, there is>nothing to prohibit other modifiers from being present as well. For>example, the translation:> Shift<Key>q: quit()>will take effect even if the Ctrl key is held down at the same time as>the Shift key (and the q key).This is true for accelerators and mnemonics, which are implemented usingevent handlers instead of grabs; it's not true for menu accelerators. Ifyou're a Motif implementor, I'd suggest lobbying to get the Xlib semanticschanged to support the feature I described above. Otherwise, change thedocumentation for menu accelerators to properly set the user'sexpectations, because menu accelerators are NOT the same thing astranslations.>Is it possible to supply > 1 accelerator for a menu entry?If you mean "menu accelerator", no it's not possible. That's according tothe definition of the XmNaccelerator resource in the XmLabel manual page.>Keep in mind when answering this question that when using Motif you>can't use XtInstallAccelerators().I can't think of a reason why not.>How can you ensure that accelerators work the same independent of>case? What I want is Ctrl+O and Ctrl+o to both be accelerators on one>menu entry.There is a workaround for Motif users. In addition to the normal menuaccelerator you install on the XmPushButton[Gadget], set an XtNacceleratorsresource on the shell (TopLevel or Application). Install the shell'saccelerators on itself and all of its descendants withXtInstallAllAccelerators (shell, shell).For example, applicationShell - mainWindow - menuBar - fileCascade -- filePulldown - openPushbutton - exitPushbutton *openPushbutton.accelerator = Ctrl<Key>O *openPushbutton.acceleratorText = Ctrl+O *exitPushbutton.accelerator = Ctrl<Key>Q *exitPushbutton.acceleratorText = Ctrl+Q *applicationShell.accelerators = #override\n\ Ctrl<Key>O: PerformAction(*openPushbutton, ArmAndActivate)\n\ Ctrl<Key>Q: PerformAction(*exitPushbutton, ArmAndActivate)You have to write and add the application action PerformAction, which youcan implement by using XtNameToWidget on the first argument and thenXtCallActionProc with the rest of the arguments.I tested out something similar to this. To shorten development time, Iused TeleUSE's TuNinstallAccelerators resource to install the acceleratorson the shell, and I directly invoked the Open and Quit D actions insteadof asking the pushbuttons to do it for me, but the more general approach Idescribed above should work.-- Trevor Bourget (trevor@telesoft.com)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -