L_AnnSetAutoMenuItemEnable

#include "l_bitmap.h"

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

HANNOBJECT hObject;

/* handle to the annotation object */

L_INT nObjectType;

/* type of annotation object */

L_UINT uItem;

/* constant for the specified item */

L_UINT uEnable;

/* flag that indicates whether to enable or disable an item */

L_UINT uFlags;

/* flags that determine which objects to process */

L_TCHAR *pUserList;

/* character string that contains the user list */

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

This function is available in the Document and Medical Imaging toolkits.

Parameter

Description

hObject

Handle to the annotation object.

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.

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:

 

Annotation Automation Menu Strings

 

Annotation Automation Line Dialog Strings

 

Annotation Automation Fill Dialog Strings

 

Annotation Automation Text Dialog Strings

 

Annotation Automation Audio Dialog Strings

 

Annotation Automation Stamp Dialog Strings

 

Annotation Automation ROP2 Dialog Strings

 

Annotation Automation Lock/Unlock Dialog Strings

 

Annotation Automation Miscellaneous Dialog Strings

 

Annotation Automation Ruler Dialog Strings

 

Annotation Automation Point Dialog Strings

 

Annotation Automation Video Dialog Strings

 

Annotation Automation Push Pin Dialog Strings

 

Annotation Automation Nodes Dialog Strings

 

Annotation Automation Protractor Dialog Strings

 

Annotation Automation Name Dialog Strings

 

Annotation Automation Play Video Dialog Strings

 

Annotation Automation Stamp Metafile Dialog Strings

 

Annotation Automation ToolTip Dialog Strings

 

Annotation Automation Transparent Color Dialog Strings

 

Annotation Automation Capture Dialog Strings

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.

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.

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

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

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

Windows 2000 / XP/Vista.

See Also

Functions:

L_AnnGetAutoMenuItemEnable, L_AnnSetAutoText, L_AnnGetAutoText, L_AnnGetAutoMenuState, L_AnnSetAutoMenuState, 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 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;
}