L_AnnSetAutoMenuItemEnable

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetAutoMenuItemEnable(hObject, nObjectType, uItem, uEnable, uFlags, pUserList)

Enables or disables a menu item for one or more annotation objects.

Parameters

HANNOBJECT hObject

Handle to the annotation object.

L_INT nObjectType

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

L_UINT uItem

Constant that specifies the menu or dialog box item to enable or disable. For lists of constants and their default values, refer to the following:

L_UINT uEnable

Flag that indicates whether to enable or disable the specified item. Possible values are:

Value Meaning
ANNMENU_ENABLED Enable the menu item.
ANNMENU_DISABLED Disable the menu item.
ANNMENU_DEFAULT Enable or disable the menu item, based on the setting for the object type.

L_UINT 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.
ANNFLAG_USER [0x0040] Process only those objects that have a user included in pUserList. If pUserList is NULL, process only those objects that do not have an associated user.

L_TCHAR *pUserList

Character string that contains the list of users associated with the specified object. pUserList has the form "User1,User2,,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in uFlags.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

By default, all automation menu items that are not NULL are displayed.

If an automation menu item is NULL, that menu item will not be displayed, even if the menu item has been enabled using this function.

The menu item strings are changed using the L_AnnSetAutoText function.

Menu items can be enabled or disabled for one or more than one object, depending on the object passed in the hObject parameter. The following table indicates the possible options:

Menu Item String Status hObject nObjectType Result
NULL Enabled Annotation or automation Any type Menu item is not displayed.
NULL Disabled Annotation or automation Any type Menu item is not displayed.
Not NULL Disabled Automation object ANNOBJECT_XXX Menu item is not displayed for all objects of type ANNOBJECT_XXX.
Not NULL Disabled Automation object ANNOBJECT_ALL Menu item is not displayed for all objects.
Not NULL Enabled Automation object ANNOBJECT_XXX Menu item is displayed for all objects of type ANNOBJECT_XXX.
Not NULL Enabled Automation object ANNOBJECT_ALL Menu item is displayed for all objects.
Not NULL Disabled Annotation object Ignored Menu item is not displayed for the specified object, based on the value of uFlags.
Not NULL Enabled Annotation object Ignored Menu item is displayed for the specified object, based on the value of uFlags.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT AnnSetAutoMenuItemEnableExample(HANNOBJECT hAutoObject) 
{ 
   L_INT nRet; 
  L_UINT Enable; 
 
  nRet = L_AnnGetAutoMenuItemEnable(hAutoObject, ANNOBJECT_ALL, ANNAUTOTEXT_MENU_CUT, &Enable); 
  if(nRet != SUCCESS) 
     return nRet; 
  if (Enable == ANNMENU_ENABLED) 
  { 
     MessageBox(NULL, TEXT("Menu item is enabled. It will now be disabled."), TEXT(""), MB_OK); 
     nRet = L_AnnSetAutoMenuItemEnable(hAutoObject, ANNOBJECT_ALL, ANNAUTOTEXT_MENU_CUT, ANNMENU_DISABLED, 0, NULL); 
     if(nRet != SUCCESS) 
        return nRet; 
  } 
  else if (Enable == ANNMENU_DISABLED) 
  { 
     MessageBox(NULL, TEXT("Menu item is disabled. It will be enabled."), TEXT(""), MB_OK); 
     nRet = L_AnnSetAutoMenuItemEnable(hAutoObject, ANNOBJECT_ALL, ANNAUTOTEXT_MENU_CUT, ANNMENU_ENABLED, 0, NULL); 
     if(nRet != SUCCESS) 
        return nRet; 
  } 
  else 
  { 
     MessageBox(NULL, TEXT("Menu item is using its default behavior. It will be disabled."), TEXT(""), MB_OK); 
     nRet = L_AnnSetAutoMenuItemEnable(hAutoObject, ANNOBJECT_ALL, ANNAUTOTEXT_MENU_CUT, ANNMENU_DISABLED, 0, NULL); 
     if(nRet != SUCCESS) 
        return nRet; 
  } 
   return SUCCESS; 
} 
Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.