Inserts a text token into the text token table.
#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnInsertTextTokenTable(hAutomation, pTextToken)
Handle to the annotation automation object.
Pointer to a structure that defines the text token table to insert.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The text token table is stored in the automation object, so this function is valid only for the ANNOBJECT_AUTOMATION annotation object.
This function inserts a token defined by pTextToken
into the text token table. If the token already exists, the existing token is overwritten. If the token does not already exist, it is created.
The text token table can be displayed by performing the following steps:
Click the Insert Token button. A menu for the existing text token table appears, as shown in the following figure:
Select the token to be inserted.
Note that the text token table above contains a separator. To add a separator, set TextToken as shown in the following code:
ANNTEXTTOKEN TextToken;
TextToken.nSize = sizeof(ANNTEXTTOKEN);
TextToken.cToken = 0;
TextToken.nTokenType = ANNTOKEN_SEPARATOR;
For a sample that illustrates how to define the text token table depicted above, see the Example.
Win32, x64.
This example defines a new user token to display the current date in mm/dd/yyyy format.
It defines a separate token for company name:
#c is the company name token.
Add this sample to the main annotation demo (\Examples\Annotation\C\Annotate)
After running this sample:
Draw a text box
L_INT AnnInsertTextTokenTableExample(HANNOBJECT hAutomation)
{
L_INT nRet;
ANNTEXTTOKEN TextToken;
memset(&TextToken, 0, sizeof(ANNTEXTTOKEN));
TextToken.uStructSize = sizeof(ANNTEXTTOKEN);
// Clear the current text token table
nRet = L_AnnClearTextTokenTable(hAutomation);
if (nRet != SUCCESS)
return nRet;
// Define token for two digit month
TextToken.cToken = '0';
TextToken.pszDesc = TEXT("Two Digit Month");
TextToken.pszTokenString = NULL;
TextToken.nTokenType = ANNTOKEN_DATE_MM;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
// Define token for two digit day
TextToken.cToken = '1';
TextToken.pszDesc = TEXT("Two Digit day");
TextToken.pszTokenString = NULL;
TextToken.nTokenType = ANNTOKEN_DATE_DD;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
// Define token for four digit year
TextToken.cToken = '2';
TextToken.pszDesc = TEXT("Two Digit day");
TextToken.pszTokenString = NULL;
TextToken.nTokenType = ANNTOKEN_DATE_YYYY;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
// Add a separator
TextToken.cToken = 0;
TextToken.pszDesc = NULL;
TextToken.pszTokenString = NULL;
TextToken.nTokenType = ANNTOKEN_SEPARATOR;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
// Define token for mm/dd/yyyy
TextToken.cToken = 'D';
TextToken.pszDesc = TEXT("Date: mm/dd/yyyy");
TextToken.pszTokenString = TEXT("#0/#1/#2");
TextToken.nTokenType = ANNTOKEN_TEXT;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
// Define token for company name
TextToken.cToken = 'c';
TextToken.pszDesc = TEXT("Company Name");
TextToken.pszTokenString = TEXT("Your Company Name");
TextToken.nTokenType = ANNTOKEN_TEXT;
nRet = L_AnnInsertTextTokenTable(hAutomation, &TextToken);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document