[Insight-users] how to get mouse position

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 27 12:08:34 EDT 2010


Hi Erkang,

Please post questions about VTK to the vtkusers list:

    http://www.vtk.org/mailman/listinfo/vtkusers

---------------

Should you have any questions about the Insight Toolkit
(ITK), we will be happy to assist you here in this list.



   Regards,


            Luis


------------------------------------------------------------------------------------
On Thu, Mar 25, 2010 at 10:31 PM, Erkang Cheng <ekyaya at gmail.com> wrote:
> 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
>
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list