Newsgroups: comp.windows.open-look
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!csn!stan!marvin!toml
From: toml@marvin.Solbourne.COM (Tom LaStrange)
Subject: Re: Using the Xt Translation Manager with XView
In-Reply-To: siebers@catalonia.sw.mcc.com's message of 21 May 91 19:01:55 GMT
Message-ID: <TOML.91May21164159@marvin.Solbourne.COM>
Sender: toml@solbourne.com (Tom LaStrange)
Organization: Solbourne Computer, Inc.
References: <5196@catalonia.sw.mcc.com>
Date: 21 May 91 16:41:59

> 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
