L_DispContainerIsButtonValid

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerIsButtonValid(hCon, nAction, nMouseButton, uFlags)

HDISPCONTAINER hCon;

/* handle to the container */

L_INT nAction;

/* action ID*/

L_INT nMouseButton;

/* mouse button */

L_UINT uFlags;

/* reserved for future use */

Checks the validity of assigning a button to a specific action.

Parameter

Description

hCon

Handle to the container.

nAction

Value that represents the action, which the user wants to check the validity of assigning a button to it. If nAction is equal to or greater than 100 then its a user-defined action. Otherwise it should be one of the following predefined actions:

 

Value

Meaning

 

CONTAINER_ACTION_WINDOWLEVEL

[1] Window leveling

 

CONTAINER_ACTION_SCALE

[2] Scaling

 

CONTAINER_ACTION_OFFSET

[3] Offset

 

CONTAINER_ACTION_STACK

[4] Stacking

 

CONTAINER_ACTION_MAG

[5] Magnifying glass

 

CONTAINER_ACTION_ALPHA

[6] Alpha

 

CONTAINER_ACTION_ANNOTATION_RULER

[7] Ruler annotation

 

CONTAINER_ACTION_ANNOTATION_ANGLE

[8] Angle annotation

 

CONTAINER_ACTION_ANNOTATION_TEXT

[9] Text annotation

 

CONTAINER_ACTION_ANNOTATION_ARROW

[10] Arrow annotation

 

CONTAINER_ACTION_ANNOTATION_RECTANGLE

[11] Rectangle annotation

 

CONTAINER_ACTION_ANNOTATION_ELLIPSE

[12] Ellipse annotation

 

CONTAINER_ACTION_ANNOTATION_HILITE

[13] Hilite annotation

 

CONTAINER_ACTION_REGION_RECTANGLE

[14] Rectangular region

 

CONTAINER_ACTION_REGION_ELLIPSE

[15] Elliptical region

 

CONTAINER_ACTION_REGION_FREEHAND

[16] Free hand region

 

CONTAINER_ACTION_REGION_POLYGON

[17] Polygon region

 

CONTAINER_ACTION_REGION_MAGICWAND

[18] Magic wand (contiguous color) region

 

CONTAINER_ACTION_REGION_COLORRANGE

[19] Color range region

 

CONTAINER_ACTION_REGION_CIRCLE

[20] Circular region

 

CONTAINER_ACTION_REGION_SQUARE

[21] Square region

 

CONTAINER_ACTION_REGION_NUDGETOOL

[22] Nudge tool

 

CONTAINER_ACTION_REGION_SHRINKTOOL

[23] Shrink tool

nMouseButton

Pointer to a variable to be updated with the mouse button value. Possible values are:

 

Value

Meaning

 

CONTAINER_MOUSE_BUTTON_NONE

[0x000] No button is assigned.

 

CONTAINER_MOUSE_BUTTON_LEFT

[0x001] Left mouse button.

 

CONTAINER_MOUSE_BUTTON_RIGHT

[0x002] Right mouse button.

 

CONTAINER_MOUSE_BUTTON_MIDDLE

[0x003] Middle mouse button.

 

CONTAINER_MOUSE_WHEEL

[0x004] Mouse wheel.

 

CONTAINER_MOUSE_BUTTON_XBUTTON1

[0x005] X button 1.

 

CONTAINER_MOUSE_BUTTON_XBUTTON2

[0x006] X button 2.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The mouse button is valid for this action.

0

The mouse button is not valid for this action.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is preferred to use before calling the L_DispContainerSetAction function to check the validity of assigning a button to a specific action. For example, if the user passed CONTAINER_MOUSE_WHEEL to the MouseButton parameter and CONTAINER_ACTION_MAG to the nAction parameter of the L_DispContainerSetAction function, it will return ERROR_INV_PARAMETER, while if the same values are passed as parameters to this function, it will return 0 as an indication that the mouse button is not valid for this action.

Required DLLs and Libraries

LTIVW

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:

L_DispContainerAddAction, L_DispContainerSetActionProperties, L_DispContainerGetActionProperties, L_DispContainerRemoveAction, L_DispContainerGetActionCount, L_DispContainerSetKeyboardAction, L_DispContainerGetKeyboardAction, L_DispContainerIsActionActive, L_DispContainerGetActionCallBack, L_DispContainerSetActionCallBack, L_DispContainerSetAction, L_DispContainerGetActionButton

Topics:

Applying Actions

Image Viewer Functions: Applying Actions

Example

This function assignes the magnify glass to the mouse button, but it will do nothing if the magnify glass was already assigned.

L_INT DispContainerIsButtonValidExample(HDISPCONTAINER hCon, L_INT nMouseButton)
{
   L_INT  nButton;
   L_UINT uFlag;
   L_INT  nRet;

   nRet = L_DispContainerGetActionButton(hCon, CONTAINER_ACTION_MAG, &nButton, &uFlag);
   if (nRet != SUCCESS)
      return nRet;

   if (!nButton)
   {
      if (L_DispContainerIsButtonValid(hCon, CONTAINER_ACTION_MAG, nMouseButton, 0))
      {
         nRet = L_DispContainerSetAction(hCon, CONTAINER_ACTION_MAG, nMouseButton, 0);
         if (nRet != SUCCESS)
            return nRet;
      }
   }
   return SUCCESS;
}