[comp.windows.x] Dynamic Management of Translation Tables

skertic@sal-sun65.usc.edu (Robert Skertic) (10/18/89)

SUBJECT:  Dynamic management of Translation table
REFERENCE Articles: 14758,14773,14775,14780

Dear X community:

As part of my project, I would like to dynamically manage
the translation table within one Editable Text Widget without
having to recompile my alternating translation tables each time.

In my default setup I have put the most commonly referenced
mapping -- my user defined Read Only mapping.  So, when the
Editable text widget is realized, the user is unable to
use the keyboard.  Upon asking permission to edit, via a
command widget with a highlighted area, I Override my default
translation table with X's default table 'defaultTextTranslations'.
The user may edit the select REGION of text only.  If the user's 
cursor goes outside the bounds of the selected region (the
selected region is 'alive' in that it grows with inserted text and
decreases with deleted text), then I Override the Translation
table back to my default "READ Only" table.  I have yet
to make the above scheme work!!

Since I had problems understanding Key to Sym commands, I thought
I had better write and ask the experts.  Surely there is a way
to have two translation tables loaded and just switch the
pointer to the proper table whenever I please??  

First, is it possible to do what I am proposing.  Second,
what would be the most efficient manner to do this?

Should I be using the structure XtTMRec? 

I realize that with a few more hours of blood, sweat and tears
I could probable answer my own questions...but, like all of us,
I am on a time schedule.  And besides, this is what makes this
news network such a great assistance to all.

As always, I thank you ahead of time for your time and effort,

Bob Skertic   
skertic@girtab.usc.edu

swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/18/89)

> Surely there is a way
> to have two translation tables loaded and just switch the
> pointer to the proper table whenever I please??  

Yes; the way to do this is by calling XtSetValues on the
XtNtranslations resource.

> First, is it possible to do what I am proposing.

Shouldn't be too hard.  We have done something similar for
the R4 version of xmh.

> Should I be using the structure XtTMRec? 

No not directly; it's an internal Xt structure.  All you
need is an XtTranslations opaque type, which you get from 
XtParseTranslationTable or from XtGetValues.