Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a tool tip on CNiGraph3D

Hi
I have a CNiGraph3D object on the user interface. When the user clicks on the graph, I want to show the coordinate of the point clicked on a tool tip. Do u know how to create a tool tip for CNiGraph3D?
I use this function to handle the event the user click on a graph
 
void CTestCNiGraphDlg::OnPlotAreaMouseDownCwgraph3d1(short FAR* Button, short FAR* Shift, VARIANT FAR* XNear, VARIANT FAR* YNear, VARIANT FAR* ZNear, VARIANT FAR* XFar, VARIANT FAR* YFar, VARIANT FAR* ZFar)
{
//get the corrdinate
float fX,fY,fZ;
  CNiVariant TempV = CNiVariant(XFar);
  fX = TempV.operator float();
  TempV = CNiVariant(YFar);
  fY = TempV.operator float();
  TempV = CNiVariant(ZFar);
  fZ = TempV.operator float();
//how do I display a tool tip that has the coordinate? (fX, fY, fZ)
}
Thanks
 
0 Kudos
Message 1 of 5
(4,033 Views)

I don't know why the icon came up at the function I had, anyway, the function I used is OnPlotAreaMouseDown

0 Kudos
Message 2 of 5
(4,032 Views)
Irene,

I believe that you will have to implement your own code if you need a dynamic message in the Tool Tip.  The following web page has an MFC implementation of a Tool Tip:

http://www.codeguru.com/Cpp/controls/controls/tooltipcontrols/article.php/c2173/

You can try to implement your own version of this code, or you may try directly adding it to your application.  Using the above code, you can simply set the text of the Tool Tip class to the X, Y, and Z values of from the function call, as you have already shown.

Regards,

Tyler T.
0 Kudos
Message 3 of 5
(4,016 Views)

Hi Tyler

Now I have another problem with my graph. X Axis of my graph runs from 0 to 3, and so does Y. I have data plotted from X=0 to 2 and Y = 0 to 2. I use 3D graph. The problem is, when I click on coordiante (2,2), (3,0),(3,1), (3,2),(3,3), (0,3),(1,3),(2,3),(3,3), the  OnPlotAreaMouseDown doesn't get called, but if I click on the other points in the graph, it gets called.

So I created a new Measurement Studio project and put a graph on, and try the OnPlotAreaMouseDown to see if it gets call anywhere on the graph that gets clicked. The result is it works fine on every point..so there's gotta be something wrong with my graph on the other project. Do u have any idea or guess of what can be the cause? I can't duplicate the problem because the code on the other project is large and complicated.

Thank you

0 Kudos
Message 4 of 5
(4,007 Views)
Irene,

Do you only get this problem after integrating the Custom Tool Tip code?  If you remove the Tool Tip code does it work properly?  Are there any special configurations that you are placing on the 3D Plot in the code that does not work.  Compare the Z-Depth of the plot that works and the one that does not work.  I would go through and compare the properties and settings for the two different plots.  If you believe it is the Custom Tool Tip code that is causing the problem, then I would try adding it to a fresh Project and seeing if that creates the problem.  I noticed that the Custom Tool Tip code was written for Visual C++ 6.0 and there may have been some changes that are causing the problem.

Let me know what you find out.

Thanks,

Tyler T.
0 Kudos
Message 5 of 5
(3,988 Views)