LAnnotation::TextEdit

#include "ltwrappr.h"

L_INT LAnnotation::TextEdit()

Causes a text-based annotation to enter edit mode.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function causes a text-based annotation to enter edit mode, which displays an edit window for direct entry of text. Calling this function allows a user to programmatically force an object into edit modean action that is normally available in automation mode when creating or double-clicking text-based annotations.

It can be used with any of the text-based annotation classes including:

LAnnText

LAnnTextPointer

LAnnNote

LAnnPushPin

LAnnRTF

A successful call to LAnnXXX::SetText affects the class object in the following way:

If the class object is not selected, the class object becomes selected, and all other objects become unselected.

If the class object is already selected, then the selection state of all objects is unchanged.

If the class object is one of several objects selected, then the selection state of all objects is unchanged.

Only one object can be in text edit mode. Therefore, if another text object is in text edit mode, calling LAnnotation::TextEdit(), will get the other class object out of the text edit mode, and put the class object into the text edit mode.

This function will fail with ERROR_AUTOMATION_INV_HANDLE if the class object is not contained in the root container and if it is not in the automated mode.

This function works only with the following objects:

LAnnText

LAnnTextPointer

LAnnNote

LAnnPushPin

LAnnRTF

If you pass an object that is not one of these types, the function will return ERROR_INV_PARAMETER.

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnnAutomation::GetAutoText, LAnnAutomation::GetAutoTextLen, LAnnAutomation::SetAutoText

Topics:

Annotation Functions: Getting and Setting Text Properties

Example

L_INT LAnnotation_TextEditExample(LAnnText anntext)
{
   // This example programmatically makes an annotation text object
   // hObject go into edit mode
   // Note that hObject must be a text based annotation
   L_INT nRet = SUCCESS;
   L_UINT uType = 0;
   L_TCHAR *pszError = NULL;
   UNREFERENCED_PARAMETER(uType);
   nRet = anntext.TextEdit();
   switch(nRet)
   {
      case SUCCESS:
         pszError = TEXT("SUCCESS");
         break;
      case ERROR_AUTOMATION_INV_HANDLE:
         pszError = TEXT("TextEdit failed because you are not in automated mode");
         break;
      case ERROR_INV_PARAMETER:
         pszError = TEXT("AnnTextEdit failed because hObject was not text based");
         break;
      default:
         pszError = TEXT("AnnTextEdit failed");
      break;
   }
   if (pszError)
   {
      MessageBox(NULL, pszError, TEXT("Error"), MB_OK);
      return FAILURE;
   }
   return nRet;
}