[comp.windows.open-look] Using the Xt Translation Manager with XView

toml@marvin.Solbourne.COM (Tom LaStrange) (05/21/91)

> We have an XView application with which we would like to use the Xt Intrinsics'
> Translation Manager to assign action procedures to user-specified input events.
> I was wondering if someone else had attempted this already, or if anyone had
> some idea of how difficult this task might be.  I assume that I will not be
> able to do something as simple as calling the following functions during
> start-up:
> 
> 	XtToolkitInitialize()  to initialize data structures
> 
> 	somehow create an Xt widget out of an XView window
> 
> 	XtAddActions()  to register the action procedures
> 
> 	XtParseTranslationTable()  to compile the translation table
> 
> 	XtAugmentTranslations()  to install the compiled translations
> 
> and then calling XtDispatchEvent() -- or perhaps _XtTranslateEvent() -- from
> the XView WIN_EVENT_PROC to see whether the current event can be dispatched to
> an action procedure.
> 
> If there is no chance of (something like) the above working, do you think that
> the best approach would be to reproduce the Translation Manager functionality
> in the application code -- perhaps using as much of the Xt Intrinsics TM code
> as possible?


Having done this for the Object Interface toolkit (twice) I can tell you first
hand that it is a pain in the butt.  The first cut at this is what is currently
shipping in OI and contains a port of the Xt code converted to understand
OI objects rather than widgets.  The second attempt at this was a rewrite/port
of the Xt code that makes many of the common TM data structures into C++ 
classes, cuts down on memory usage, more flexible accelerator/mnemonic
capabilities, etc. etc.

The TM code assumes it's dealing with Widgets, period.  Shoehorning any other
object type in is going to be painful.  Also, the TM code relies heavily on
X events that are generated on X windows.  Any toolkit that implements
windowless objects (I think XView does a lot of this) is going to even
have more of a challenge.  Does Xt provide accelerators for gadgets?  I'm
not sure.

If you're looking for a time frame, it took me two months to do the initial
port.  That two months also included learning about the translation 
mechanism and becoming familiar with the Xt code.

--
(I kid you not)Tom LaStrange        toml@Solbourne.COM

siebers@catalonia.sw.mcc.com (Greg Siebers) (05/22/91)

We have an XView application with which we would like to use the Xt Intrinsics'
Translation Manager to assign action procedures to user-specified input events.
I was wondering if someone else had attempted this already, or if anyone had
some idea of how difficult this task might be.  I assume that I will not be
able to do something as simple as calling the following functions during
start-up:

        XtToolkitInitialize()  to initialize data structures

        somehow create an Xt widget out of an XView window

        XtAddActions()  to register the action procedures

        XtParseTranslationTable()  to compile the translation table

        XtAugmentTranslations()  to install the compiled translations

and then calling XtDispatchEvent() -- or perhaps _XtTranslateEvent() -- from
the XView WIN_EVENT_PROC to see whether the current event can be dispatched to
an action procedure.

If there is no chance of (something like) the above working, do you think that
the best approach would be to reproduce the Translation Manager functionality
in the application code -- perhaps using as much of the Xt Intrinsics TM code
as possible?

Thanks very much for your advice.

    -----------------------------------------------------------------
      Gregory R. Siebers  | MAIL: P.O. Box 200195, Austin, TX 78720
      MCC SW Technology   | ARPA: siebers@mcc.com
        (512) 338-3656    | UUCP: ...!cs.utexas.edu!milano!siebers
    -----------------------------------------------------------------