LImageViewer::SetAction

#include "ltwrappr.h"

L_INT LImageViewer::SetAction (nAction, nMouseButton, uFlags);

L_INT nAction;

/* action to set */

L_INT nMouseButton;

/* mouse button indicator */

L_UINT uFlags;

/* flag */

Specifies the action for each one of the mouse buttons.

Parameter

Description

nAction

Value that indicates the action to associate with the specified mouse button. If nAction is equal or greater than 100 then its a user-defined action. Otherwise, it can be one of the following predefined actions:

 

Value

Meaning

 

CONTAINER_ACTION_NONE

[0] No action. Also referred to as select mode." In this mode no action is applied when the mouse is dragged. You can still select, adjust and move the annotation objects.

 

CONTAINER_ACTION_WINDOWLEVEL

[1] Window leveling. Moving the mouse horizontally controls the window center parameter of the window level. Moving the mouse vertically controls the window width parameter of the window level.

 

CONTAINER_ACTION_SCALE

[2] Scaling. Moving the mouse vertically controls the scale factor of the image.

 

CONTAINER_ACTION_OFFSET

[3] Offset. Moving the mouse to any direction causes the image moving towards that direction.

 

CONTAINER_ACTION_STACK

[4] Stacking. Moving the mouse vertically scrolls through the frames.

 

CONTAINER_ACTION_MAG

[5] Magnifying glass. Moving the mouse causes the magnify glass object to move.

 

CONTAINER_ACTION_ALPHA

[6] Alpha. Moving the mouse horizontally changes the alpha factor of the LUT curve.

 

CONTAINER_ACTION_ANNOTATION_RULER

[7] Ruler annotation. Clicking and dragging creates a ruler object.

 

CONTAINER_ACTION_ANNOTATION_ANGLE

[8] Angle annotation. Clicking and dragging creates an angle object.

 

CONTAINER_ACTION_ANNOTATION_TEXT

[9] Text annotation. Clicking and dragging creates a text object.

 

CONTAINER_ACTION_ANNOTATION_ARROW

[10] Arrow annotation. Clicking and dragging creates an arrow object.

 

CONTAINER_ACTION_ANNOTATION_RECTANGLE

[11] Rectangle annotation. Clicking and dragging creates a rectangle object.

 

CONTAINER_ACTION_ANNOTATION_ELLIPSE

[12] Ellipse annotation. Clicking and dragging creates an ellipse object.

 

CONTAINER_ACTION_ANNOTATION_HILITE

[13] Highlight annotation. Clicking and dragging creates a highlight object.

 

CONTAINER_ACTION_REGION_RECTANGLE

[14] Rectangular region. Clicking and dragging creates a rectangular region.

 

CONTAINER_ACTION_REGION_ELLIPSE

[15] Elliptical region. Clicking and dragging creates an elliptical region.

 

CONTAINER_ACTION_REGION_FREEHAND

[16] Free hand region. Clicking and dragging creates a free hand region.

 

CONTAINER_ACTION_REGION_POLYGON

[17] Polygon region. Clicking defines the point of the polygon. Double-clicking closes the polygon region.

 

CONTAINER_ACTION_REGION_MAGICWAND

[18] Magic wand region. Clicking defines the starting point and color. The region will grow outwards from the selected point to the boundaries of that color. Dragging will increase the threshold of variation allowed from the selected color.

 

CONTAINER_ACTION_REGION_COLORRANGE

[19] Color range region. Moving the mouse horizontally controls the lower tolerance. Moving the mouse vertically controls the upper tolerance.

 

CONTAINER_ACTION_REGION_CIRCLE

[20] Circular region. Clicking and dragging creates a circular region.

 

CONTAINER_ACTION_REGION_SQUARE

[21] Square region. Clicking and dragging creates a square region.

 

CONTAINER_ACTION_REGION_NUDGETOOL

[22] Nudge tool. Clicking and dragging will add a region to the existing region (if exists).Pressing Shift while pressing the mouse will inverse this effect, making it act like the shrink tool. This action can be used as a nudge tool to nudge the edge of the existing region, or it can be used as a region painter. You can change the shape of the brush and the size of it using the properties of the corresponding structure and then send it through the function LImageViewer::SetActionProperties. For more information, see DISPNUDGETOOLACTIONPROPS.

 

CONTAINER_ACTION_REGION_SHRINKTOOL

[23] Shrink tool. Clicking and dragging will remove parts of the region from the existing region (if exists). Pressing Shift while pressing the mouse will inverse this effect, making it act like the nudge tool. This action can be used to reduce or trim the existing region.  You can change the shape and size of the brush using the properties of the corresponding structure, and then send it through the function LImageViewer::SetActionProperties. For more information, see DISPNUDGETOOLACTIONPROPS.

nMouseButton

Value that indicates the mouse event to be associated with the specified action. Possible values are:

 

Value

Meaning

 

CONTAINER_MOUSE_BUTTON_NONE

[0x000] No button is attached.

 

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

Flags that indicate the cells to which the action is applied and when the action is applied. The following flags indicate the cells to which the action is applied:

 

Possible values are:

 

Value

Meaning

 

DCACTION_ACTIVEONLY

[0x0000] Apply the effect on the active cell window only.

 

DCACTION_ALLCELLS

[0x0001] Apply the effect on all the cells.

 

DCACTION_SELECTED

[0x0002] Apply the effect on the selected cells only.

 

The following flags indicate when the action is applied:

 

DCACTION_REALTIME

[0x0000] Apply the action during the mouse movement. This option is only valid if either DCACTION_ALLCELLS or DCACTION_SELECTED is also set.

 

DCACTION_ONRELEASE

[0x0001] Apply the action after releasing the mouse button. This option is only valid if either DCACTION_ALLCELLS or DCACTION_SELECTED is also set.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

An action must be added to a container before it can be assigned to a mouse button. To add an action to a container call LImageViewer::AddAction.

If an action is set to a mouse button that is already used by another action, the new action will overwrite the old one.

uFlags is used only with the following actions:

Window level

Alpha

Offset

Scale

Stack

for any other action, uFlags must  be 0, otherwise, the function will return ERROR_INV_PARAMETER.

Actions can also be associated with keystroke combinations. To assign an action to a keystroke combination, call LImageViewer::SetKeyboardAction.

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:

LImageViewer::AddAction, LImageViewer::SetActionProperties, LImageViewer::GetActionProperties, LImageViewer::RemoveAction, LImageViewer::GetActionCount, LImageViewer::SetKeyboardAction, LImageViewer::GetKeyboardAction, LImageViewer::IsActionActive, LImageViewer::EnableActionCallBack, Class Members

Topics:

Applying Actions

 

Window Control/Image Viewer Functions: Applying Actions

Example

For an example, refer to LImageViewer::Create.