[comp.windows.x] Translations and Accelerators

salevin@drlc1.UUCP (S. A. Levin[Stewart]) (10/25/89)

Setting:
MIT 11.3, TWM, Athena Widgets, unknown patch levels

I want to bind string translations to menu actions.  For concreteness,
assume I pop up a menu with two items: "start" and "stop".  I'd like
to be able to type "sta" to invoke the first and "sto" to select the
second.

Query 1:  Should the translation table:

	"<Key>s,<Key>t,<Key>a: Start()\n
	 <Key>s,<Key>t,<Key>o: Stop()\n"

	invoke the appropriate actions when installed on the menu widget?
	Can anyone point me to a working example?

Query 2:  Can I use the same translation table as an accelerator attached
	to the parent of the menu widget to completely bypass the menu
	and go directly to the actions?  If so, can you supply me with
	an example?

Please E-MAIL to stew@hanauma.stanford.edu  - Thanks.

converse@EXPO.LCS.MIT.EDU (Donna Converse) (10/27/89)

> I want to bind string translations to menu actions.  For concreteness,
> assume I pop up a menu with two items: "start" and "stop".  I'd like
> to be able to type "sta" to invoke the first and "sto" to select the
> second.
> 
> Query 1:  Should the translation table:
> 
> 	"<Key>s,<Key>t,<Key>a: Start()\n
> 	 <Key>s,<Key>t,<Key>o: Stop()\n"
> 
> 	invoke the appropriate actions when installed on the menu widget?

With a backslash at the end of the first line, you can specify this
as the definition of the Accelerator resource of your menu widget in
an application default file, and yes, you can have 3-key accelerators.

The accelerator source widget is the menu widget, and the acclerator
destination widget is where ever those accelerators are defined, where
ever you expect the keyboard sequence "sta" to execute the Start action.