Path: utzoo!attcan!uunet!husc6!ukma!mailrus!ames!fxgrp!grady From: grady@fxgrp (Steven Grady) Newsgroups: comp.windows.x Subject: accelerators Message-ID: <861@fxgrp.UUCP> Date: 10 Nov 88 05:13:30 GMT Sender: grady@fxgrp.UUCP Reply-To: grady@fxgrp (Steven Grady) Organization: FX Development Group, Inc., Mountain View, CA Lines: 53 Ater reading and rereading (ad infinitum) the 1-page section (10.4) on accelerators in the Xt doc, I think I'm finally starting to understand them. The documentation is rather opaque, so I'm not sure about this, but tell me if I have this right. An accelerator is simply a registered set of translations which can be exported to other widgets. For instance, a menu widget might include a translation like "X: itemX()" to indicate that hitting Ctrl-X invokes the itemX() function. This accelerator can be used after it has been installed in other widgets, using XtInstallAccelerators(). The destination widget, after this call, will have all the mappings of the accelerators of the source widget available. Thus, if I say "XtInstallAccelerators(textEditingWidget, menuWidget)", then all my accelerators for the menu widget will now be available from within the context of the text-editing widget. Do I have it right so far? OK, assuming I do.. What does it mean to "display" an accelerator? Why would a widget want to display its accelerators? What exactly does the display_accelerator function do? There is a variable used by some programs, XtInheritDisplayAccelerator, which is mentioned in the Xt doc, but not described. This variable is the only reference to accelerators I've found in _any_ of the X11 code. Makes it hard to learn by looking at examples.. Does anyone actually use accelerators? My other concern is the design of accelerators in general. My thought is that it would be better to allow have widgets make public (within the application) those functions that can be associated with accelerators. Then, any widget which wants to use an accelerator can bind to that action in a way similar to other translations, ie: program*textEditingWidget.translations: #override\ X: program*menuWidget*itemX() This would allow different widgets to use different accelerators to access a function -- for instance, one widget could use "?" to pop up a help widget, whereas another could use "H". To make an accelerator available to all widgets, you could simply say: program*translations: #augment\ X: program*menuWidget*itemX() This method seems to me to be more general, and it also fits within the structure of normal translations.. Steven ...!ucbvax!grady grady@postgres.berkeley.edu