Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_AnnSetAutoMenuState

Show in webframe

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetAutoMenuState(hObject, nObjectType, pEnable, pEnableFlags, uBits, uFlags)

HANNOBJECT hObject;

/* handle to the annotation object */

L_INT nObjectType;

/* type of annotation object */

L_UCHAR *pEnable;

/* an array of bit flags */

L_UCHAR *pEnableFlags;

/* an array of bit flags */

L_UINT uBits;

/* number of bits in pEnable and pEnableFlags */

L_UINT uFlags;

/* flags that determine which objects to process */

Sets all menu items at one time.

Parameter

Description

hObject

Handle to the annotation object.

nObjectType

Constant that specifies an object's type. If hObject is an automation object, the menu items for all objects of type nObjectType will be enabled or disabled based on pEnableFlags and pEnable. For descriptions of possible object types, refer to Types of Annotations.

pEnable

An array of bit flags that specify whether to enable or disable the corresponding menu item specified in pEnableFlags. The bits in the pEnable array are ordered just like the bits in the pEnableFlags array. Therefore, if you wish to display the ANNAUTOTEXT_MENU_CUT menu item, you must make sure that pEnableFlags[0] & 0x40 == 1 is true, and that pEnable[0] & 0x40 == 1 is also true.

pEnableFlags

An array of bit flags that specify the menu items to change. The bits are ordered from most significant to least significant. Therefore, pEnableFlags[0] contains flags for menu items 0, 1, 2, 3, 4,5, 6, 7. This corresponds to ANNAUTOTEXT_MENU_UNDO, ANNAUTOTEXT_MENU_CUT, ANNAUTOTEXT_MENU_COPY, ANNAUTOTEXT_MENU_PASTE, ANNAUTOTEXT_MENU_DELETE, ANNAUTOTEXT_MENU_SELECTALL, ANNAUTOTEXT_MENU_BRINGTOFRONT, and ANNAUTOTEXT_MENU_SENDTOBACK. For example, if you wish to change the setting for ANNAUTOTEXT_MENU_CUT, make sure pEnableFlags[0] & 0x40 == 1 is true.

uBits

Number of bits in the pEnableFlags and pEnable arrays. The number of bytes pointed to by pEnable and pEnableFlags can be determined using the following equation: Bytes = (uBits + 7) / 8.

uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

 

Value

Meaning

 

0

Process only the specified object.

 

ANNFLAG_SELECTED

[0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions.

 

ANNFLAG_NOTTHIS

[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

 

ANNFLAG_RECURSE

[0x0008] Process objects within a container, and within any subcontainers, down to any level.

 

ANNFLAG_NOTCONTAINER

[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.

 

ANNFLAG_NOINVALIDATE

[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If a bit in the pEnableFlags array is set to 1, then the corresponding bit in the pEnable array determines whether the corresponding menu item will be displayed or not. If the corresponding bit in pEnable is one, the menu item will be displayed, provided the menu item string is not NULL. If the corresponding bit in pEnable is 0, the corresponding menu item will not be displayed.

If a bit in pEnableFlags is 0, the corresponding bit in pEnable is ignored, and the menu item is displayed or not displayed based on the default behavior.

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.

Platforms

Win32, x64.

See Also

Functions:

L_AnnGetAutoMenuState, L_AnnGetAutoMenuItemEnable, L_AnnSetAutoMenuItemEnable, L_AnnSetAutoText, L_AnnGetAutoText, L_AnnSetAutoHilightPen, L_AnnSetAutoSnapCursor, L_AnnGetAutoSnapCursor

Topics:

Annotation Functions: Implementing Automation

 

Implementing Annotations

 

Automated User Interface for Annotations

 

Implementing an Automated Annotation Program

 

Altering Annotation Object Settings

Example

 L_INT AnnSetAutoMenuStateExample(HANNOBJECT hAutoObject)
{
   L_INT nRet;
  L_UCHAR   pEnableFlags[2];
  L_UCHAR   pEnable[2];
  L_UCHAR   resultFlag;
  L_UINT    uBits = 16; 
  L_UCHAR   result;
  L_TCHAR   cs[256];
 
  /* Get the menu state for Note objects */
  nRet = L_AnnGetAutoMenuState(hAutoObject, ANNOBJECT_NOTE, pEnable, pEnableFlags, uBits);
  if(nRet != SUCCESS)
     return nRet;

  /* 0x40 represents the Cut menu item. Therefore test to see if the 0x40 flag has been set in pEnableFlags, indicating a change from its default behavior. */
  resultFlag = pEnableFlags[0] & 0x40;
  if (resultFlag == 0x40) /* The flag for the Cut menu item has been set */
  {
     MessageBox(NULL, TEXT("pEnableFlags is set"), TEXT(""), MB_OK); 
     /* Check to see if the same flag has been set in pEnable */
     result = pEnable[0] & 0x40;
     if (result == 0x40) /* The enable flag has been set, the menu item is enabled. */
     {
        MessageBox(NULL, TEXT("The menu item was enabled. It will be disabled."), TEXT(""), MB_OK);
        pEnable[0] = 0x00;
        nRet = L_AnnSetAutoMenuState(hAutoObject, ANNOBJECT_NOTE, pEnable, pEnableFlags, uBits, 0);
        if(nRet != SUCCESS)
           return nRet;
     }
     else /* The enable flag was not set, the menu item is disabled. */
     {
        MessageBox(NULL, TEXT("The menu item was disabled. It will be enabled."), TEXT(""), MB_OK);
        pEnable[0] = 0x40;
        nRet = L_AnnSetAutoMenuState(hAutoObject, ANNOBJECT_NOTE, pEnable, pEnableFlags, uBits, 0);
        if(nRet != SUCCESS)
           return nRet;
     }
  }
  else /* The flag for the Cut menu item was not set. Set it and disable the Cut menu item. */
  {
     pEnableFlags[0] = 0x40;
     pEnable[0] = 0;
     wsprintf (cs, TEXT("The value of pEnableFlags[0] is %X.\n"), pEnableFlags[0]);
     MessageBox(NULL, cs, TEXT(""), MB_OK);
     nRet = L_AnnSetAutoMenuState(hAutoObject, ANNOBJECT_NOTE, pEnable, pEnableFlags, uBits, 0);
     if(nRet != SUCCESS)
        return nRet;
  }
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.