Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XtParseTran(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtAugmentTranslations(1)

XtOverrideTranslations(1)

XtUninstallTranslations(1)

 

Name

XtParseTranslationTable — compile a translation table into its internal representation. 

Synopsis

XtTranslations XtParseTranslationTable(table)

    String table;

Arguments

tableSpecifies the translation table to compile. 

Description

XtParseTranslationTable compiles table into its opaque internal representation of type XtTranslations.  This function is needed when setting a translation table resource from the application.  In widget code, the default translation table is automatically parsed. 

A translation table is a string containing a list of translations, each of which maps an event sequence into one or more action procedure calls.  The translations are separated from one another by newline characters (ASCII LF).  The complete syntax of translation tables is specified in Appendix F, Translation Table Syntax.  All widget instance records contain a translation table, which is a resource with no default value. 

As an example, the default behavior of the Athena Command widget is:

•Highlight on enter window. 

•Unhighlight on exit window. 

•Invert on left button down. 

•Call callbacks and reinvert on left button up. 

The following illustrates the Command widget’s default translation table:

static String defaultTranslations =
"<EnterWindow>:Highlight()\n\
<LeaveWindow>:Unhighlight()\n\
<Btn1Down>:Set()\n\
<Btn1Up>:Notify() Unset()";

The tm_table field of the CoreClass record should be filled in at static initialization time with the string containing the class’ default translations.  If a class wants to inherit its superclass’ translations, it can store the special value XtInheritTranslations into tm_table.  After the class initialization procedures have been called, the Intrinsics compile this translation table into an efficient internal form.  Then, at widget creation time, this default translation table is used for any widgets that have not had their core translations field set by the Resource Manager or the initialize methods. 

The resource conversion mechanism automatically compiles translation tables that are set in resource files. 

Widgets need do nothing other than specify the action and translation tables for events to be processed by the Translation Manager. 

The facility to parse translation tables can also be accessed by converting a string resource into a resource of type XtRTranslationTable.  One convenient way to do this is to use the XtVaTypedArg feature of XtVaCreateWidget and XtVaSetValues.  If an empty translation table is required for any purpose, one can be obtained by calling XtParseTranslationTable and passing an empty string. 

XtAugmentTranslations and XtOverrideTranslations both expect translations in compiled form.  For more information, see Chapter 7, Events, Translations, and Accelerators, in Volume Four, X Toolkit Intrinsics Programming Manual. 

See Also

XtAugmentTranslations(1), XtOverrideTranslations(1), XtUninstallTranslations(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026