From: toml@blade.Boulder.ParcPlace.COM (Tom LaStrange)
Subject: Re: REPOST: Accelerators/Translations
Keywords: Accelerator, case
Reply-To: toml@boulder.ParcPlace.COM
Organization: ParcPlace Boulder
Lines: 68

In article <1993Apr22.162016.5923@telesoft.com>, trevor@telesoft.com (Trevor Bourget @ignite) writes:
|> In <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 combined
|> with 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 using
|> event handlers instead of grabs; it's not true for menu accelerators.  If
|> you're a Motif implementor, I'd suggest lobbying to get the Xlib semantics
|> changed to support the feature I described above.  Otherwise, change the
|> documentation for menu accelerators to properly set the user's
|> expectations, because menu accelerators are NOT the same thing as
|> translations.
|> 
|> >Is it possible to supply > 1 accelerator for a menu entry?
|> 
|> If you mean "menu accelerator", no it's not possible.  That's according to
|> the 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.

I find this thread on motif accelerators absoultly amazing.  If I were
writing an interface to keyboard accelerators, I would have one
resource called "accelerators" that took a translation table, period.
I would also implement it so that programmer never has to do any work
to get the accelerators installed.  As soon as the end-user specified
one, it would be active and automatically installed.

To get multiple accelerators on a single menu item I'd do something like:

	*menuItem.accelerators: #override \n\
		Ctrl<Key>M:	fire() \n\
		Shift<Key>L:	fire() \n

The accelerators would work exactly like translations and you would
automatically see a "Ctrl M" show up in your menuItem object.

Why in the world is the motif stuff so complicated with so many different
special cases depending on what type of widget you're dealing with?  There
has to be some reason.

Sorry for the political tone of this message...

--
Tom LaStrange        toml@boulder.ParcPlace.COM
