X_Code

Short for translation code, an x-code - as they are usually called - is simply an integer value typed as an enum.

enum X_Code
{
    X_NULL = -1,
    ...
};

They have several uses, the main use being language localisation (i.e. translations), but also they are useful for return error codes and for identifying controls and fields on a form.

Mostly though, x-codes are for translations.  One x-code represents one translated string in the current language.  You can, for instance, add a field to a form with the prompt set to X_Open.  A user will see one of the following ...

... depending on which of the 37 or so supported languages has been selected.  

There are many thousands of translated strings available within Survey Core which are numbered starting at 1.  In addition, a plugin may define its own strings and supply translations for them.  The pre-defined Survey Core x-codes are defined in tsc_xcodes.h, which is automatically included into all plugin modules.  To locate a particular string it is necessary to search tsc_xcodes.h for a match.  There is no list of the actual strings, however the names of the x-code values are usually similar to the English text, without the spaces.  For example, the string "Scale only calibration" is represented by the x-code X_ScaleOnlyCalibration.

Important: Survey Core x_Codes are under constant change. While we strive to keep existing codes unchanged in value, this is not an absolute guarantee. There is also the occasional deletion. You should check the Trimble Access-based translated strings for each new release of Trimble Access to ensure any translations you use are still intact.

All Survey Core x-code names are prefixed by X_. All plugin-defined x-codes are prefixed by PX_.

A plugin may obtain the translation for a x-code as a string by passing an x-code to the tsc_SurveyCore::Translate() method. 

Controls and fields use x-codes extensively for items such as the prompt on a field. This avoids having to specifically obtain the translation for a string; this is done automatically.  Most fields and controls also have function overloads that take a string instead of the x-code, though using the x-code system to separate translations from the code is usually worthwhile.

A plugin should define its own x-codes. TASDK has the tools and a process for adding translations to a plugin.

Note that every plugin's PX_ codes start at a high value (100 000) to prevent collisions with Survey Core x-codes.  The plugin's codes are dynamically remapped into an unused range at run time.