Omnis Technical Note TNDM0003
String Tables in Omnis Studio
For Omnis Studio 2.1 or later
By Miles Henderson
Available to download from this document are two example libraries showing the use of String Tables in Omnis Studio 2.1. To use them, download the zip file Strngtab.zip under Windows, or Strngtab.sit.hqx under MacOS, unzip/unpack all of the files into a single folder, and open the libraries using Omnis Studio 2.1. A Description of each library follows:
- This library demonstrates how String Tables can be used to support multiple languages. Clicking on the language button will allow you to select a language from a drop down list. Pressing the Set Language button will redraw all of the controls using the language selected. This library uses the main features of the String Table interface including the $getText() function.
- This library demonstrates how to use the String Label object to display information from more than one String Table.
String Table Functions
The following is a brief explanation of all String Table functions.
Functions used for creating String Tables:
Creates a String Table from an Omnis List. It should be noted that the table is created in
memory at this point. To save the table, use $savestringtable.
$loadcolumn(<Column Name>,<Table Name>,<Path Name>)
Creates a String Table using a single column of an existing String Table.
$loadstringtable(<Table Name>,<Path Name>)
Loads an existing string table.
Functions used for Saving String Tables:
Saves a string table which has been previously created. Note: A path name is not required when saving. Pathnames are only specified when creating String Tables.
Functions used for Removing String Tables:
Deletes a string table stored on disk.
Unloads a string Table from memory.
Unloads all string tables from memory.
Note: These functions are optional, as all String Tables are automatically unloaded when Omnis quits.
Functions used for accessing String Tables:
Sets the current column to <Column Name>
Gets the column name for the current column. Note that <Table Name> is not required if only one String Table is loaded.
$getcolumnnumber([<Table Name>] )
Works in a similar manner to the above but returns the column number instead of the name.
This function can be used to redraw an entire window. The function $redrawAll() in the library STRTEST uses StringTable.$redaw in order to redraw all windows after selecting a new language. This is the preferred method for redrawing String Label Objects.
$colcnt([<Table Name>] )
Returns the column count for<Table Name>.
$rowcnt([<Table Name>] )
Returns the row count for<Table Name>.
$loadlistfromtable(<Table Name> )
This function copies a String Table to an OMNIS List.