[vtkusers] how to get mouse position in MFC

Erkang Cheng ekyaya at gmail.com
Fri Mar 26 07:49:43 EDT 2010


Hi:

Could anyone give me some suggestions? I encounter a problem about vtkMFC
interaction. How to get the mouse position?

I realize the "Examples/GUI/Win32/vtkMFC"
In the vtkDLG example, there is a global static function handle_double_click
to process mouse double click event. The function is defined as:
static void handle_double_click(vtkObject* obj, unsigned long,void*, void*);

I add two Edit Controls to display the mouse position when I double click
the pvtkMFCWindow.

Two  class variables (m_x,m_y) of  Class CvtkDLGDlg are corresponding to
these two Edit Control.

I want m_x and m_y to display the position of mouse event.

In the handle_double_click function:

   vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::
SafeDownCast(obj);
   int event_pos[2];
    iren->GetEventPosition(event_pos);

These codes can get the mouse position. But, I don't know how to display m_x
and m_y.
Because handle_double_click is the global function other than a member
function in class CvtkDLGDlg .

So, how to do this:
  let m_x ,m_y be the current mouse position, and display
(UpdateData(false)) in the dialog.

I think the example of source of VTK just realize to accept the mouse event.
Actually, I want to know how to get the position and use the position to do
next process.

Could anyone help me figure out the problem. Thanks a lot.

A source code will be fine totally.

Best
Erkang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100326/7bf327a4/attachment.htm>


More information about the vtkusers mailing list