LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CWG3DGRAPH CAPTURE PLOTAREA MOUSE MOVE

How can I capture the Plot Area X,Y cordinates as the mouse moves over the Component Works 3D Graph Control using CVI 7.1.
0 Kudos
Message 1 of 4
(3,311 Views)

Hello Pete,

If you are asking about obtaining mouse coordinates relative to the entire panel, you can use the function GetGlobalMouseState to acquire the mouse coordinates.  I created a quick example program which will do this -- it is the one attached here.  If you are interested in the mouse coordinates from the 3D control you can load the Function Panel for the 3D graph and register events from the graph to create the appropriate callback function.  One even to use is the PlotAreaMouseMove which will generate an even when the mouse moves in the Plot Area, this even will return the coordinates of the mouse's position.  Its prototype (which can also be seen in the help screen with a little more information) is:

Sub ControlName_PlotAreaMouseMove( Button As Integer, Shift As Integer, XNear As Variant, YNear As Variant, ZNear As Variant, XFar As Variant, YFar As Variant, ZFar As Variant)

Where the parameters are defined as:

Button As Integer

The button that is pressed, released, or, in the case of a mouse move, the buttons that are down. 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).

Shift As Integer

The state of the <Shift> , <Ctrl> , and <Alt> keys when the button specified in the Button argument is pressed, released, or moved. 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 ). Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.

XNear As Variant

The X value of a point under the mouse pointer that was closer to the user when the event occurred.

YNear As Variant

The Y value of a point under the mouse pointer that was closer to the user when the event occurred.

ZNear As Variant

The Z value of a point under the mouse pointer that was closer to the user when the event occurred.

XFar As Variant

The X value of a point under the mouse pointer that was further from the user when the event occurred.

YFar As Variant

The Y value of a point under the mouse pointer that was further from the user when the event occurred.

ZFar As Variant

The Z value of a point under the mouse pointer that was further from the user when the event occurred.



Thanks for posting, and please let us know if you have any further questions or this did not answer your question.

Regards,

Travis M
NI

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 4
(3,290 Views)
I am trying to obtain the graphs x,y coordinates, so the PlotAreaMouseMove event is the one, I have used it in VB6 but I
don't quite understand the steps required to register the call in CVI.
 
Thanks for your reply
0 Kudos
Message 3 of 4
(3,287 Views)

Hello again Pete,

There is a pretty good example about registering ActiveX events in CVI.  In the Help menu select "find examples" and search for "ActiveX", there are a couple there that use ActiveX event registration, but the example I was referring to is called "Events".  In case you cannot find it in the example finder, I'll attach it to this post.  Please take a look at this example and let me know if you have any questions on the process.

Regards,

Travis M
NI

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 4 of 4
(3,272 Views)