LImageViewerCell::IsButtonValid

Summary

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

Syntax

#include "ltwrappr.h"

L_INT LImageViewerCell::IsButtonValid(nAction, nMouseButton, uFlags)

Parameters

L_INT 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 it is 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

L_INT 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.

L_UINT uFlags

Reserved for future use. Pass 0.

Returns

Value Meaning
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 LImageViewerCell::SetAction function to check the validity of assigning a button to a specific action. For example, if the user passed CONTAINER_MOUSE_WHEEL to the nMouseButton parameter and CONTAINER_ACTION_MAG to the nAction parameter of the LImageViewerCell::SetAction 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

See Also

Functions

Topics

Example

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

L_INT LImageViewer_IsButtonValidExample(LImageViewerCell& ImageViewerCell)  
{ 
   L_INT  nButton;  
   L_UINT uFlag;  
   L_INT nRet;  
 
   L_INT nMouseButton = CONTAINER_MOUSE_BUTTON_LEFT; 
 
   nRet = ImageViewerCell.GetActionButton(CONTAINER_ACTION_MAG, &nButton, &uFlag);  
   if (nRet != SUCCESS)  
      return nRet;  
 
   if (!nButton)  
   { 
      if (ImageViewerCell.IsButtonValid(CONTAINER_ACTION_MAG, nMouseButton, 0))  
      { 
         nRet = ImageViewerCell.SetAction (CONTAINER_ACTION_MAG, nMouseButton, 0);  
         if (nRet != SUCCESS)  
            return nRet;  
      } 
   } 
   return SUCCESS;  
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Medical Image Viewer C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.