STK X Send comments on this topic.
MouseDown Event (AgUiAxVOCntrl)
See Also  Example
Button

Returns an integer that identifies the button that was pressed to cause the event. The Button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

Note  A modal dialog cannot be used to verify these return values. Instead, the return values will be added together until the total reaches 7, after which the total will remain the same. On the other hand, you can use a modal dialog to verify the return values for a MouseUp or Click event.

Shift
An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of Shift is 6.
X
Returns a number that specifies the x-position of the current location of the mouse pointer. The x and y values are always expressed in terms of the control window coordinate system.
Y
Returns a number that specifies the y-position of the current location of the mouse pointer. The x and y values are always expressed in terms of the control window coordinate system.
Windows






Windows & Linux

Description

Occur when the user presses a mouse button.

Syntax

[Visual Basic .NET]
Public Event MouseDown( _
   ByVal Button As Integer, _
   ByVal Shift As Integer, _
   ByVal X As Integer, _
   ByVal Y As Integer _
)

[C#]
public void MouseDown(
int Button,
int Shift,
int X,
int Y
);

[Managed C++]
public: void MouseDown(
int Button,
int Shift,
int X,
int Y
);

[Java]
public  mouseDown(
ppInteger Button,
ppInteger Shift,
int X,
int Y
);

[Unmanaged C++]
public: HRESULT MouseDown(
int Button,
int Shift,
long X,
long Y
);

Parameters

Button

Returns an integer that identifies the button that was pressed to cause the event. The Button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

Note  A modal dialog cannot be used to verify these return values. Instead, the return values will be added together until the total reaches 7, after which the total will remain the same. On the other hand, you can use a modal dialog to verify the return values for a MouseUp or Click event.

Shift
An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both CTRL and ALT are pressed, the value of Shift is 6.
X
Returns a number that specifies the x-position of the current location of the mouse pointer. The x and y values are always expressed in terms of the control window coordinate system.
Y
Returns a number that specifies the y-position of the current location of the mouse pointer. The x and y values are always expressed in terms of the control window coordinate system.

Remarks

Use a MouseDown event procedure to specify actions that will occur when a given mouse button is pressed. Unlike the Click and DblClick events, MouseDown events enable you to distinguish between the left, right, and middle mouse buttons. You can also write code for mouse-keyboard combinations that use the SHIFT, CTRL, and ALT keyboard modifiers.

If you need to test for the Button or Shift arguments, you can use the constants available in AgEButtonValues and AgEShiftValues. These constants act as bit masks you can use to test for any combination of buttons without having to figure out the unique bit field value for each combination.

Note   You can use a MouseMove event procedure to respond to an event caused by moving the mouse. The Button argument for MouseDown differs from the Button argument used for MouseMove. For MouseDown, the Button argument indicates exactly one button per event, whereas for MouseMove, it indicates the current state of all buttons.

 

In VB.NET the MouseDown event is shown as  "xxxxxxxx_MouseDownEvent" in the IDE.

Example

[Visual Basic .NET] Copy Code
Private Sub AxAgUiAxVOCntrl1_MouseDownEvent( _
                            ByVal sender As Object, _
                            ByVal e As AxAGI.STKX.IAgUiAxVOCntrlEvents_MouseDownEvent) _
                  Handles AxAgUiAxVOCntrl1.MouseDownEvent

    If (e.button = AGI.STKX.AgEButtonValues.eRightPressed) And _
       (e.shift = AGI.STKX.AgEShiftValues.eCtrlPressed) Then
        ' Right mouse button click with CTRL key pressed
        ...
    End If

End Sub

See Also

© 2017 Analytical Graphics, Inc. All Rights Reserved.

STK 11.2.1 Programming Interface