[vtkusers] How to interact?

shijith shijith at ddd.co.jp
Thu Oct 21 06:49:59 EDT 2004


Hi,
I think you need to override preTranslateMessage() of the view class
and redirect the message to the current window.
for example, if you want to capture LBUTTONDOWN event, do something like
this,

BOOL CVTKDeomoView::PreTranslateMessage(MSG* pMsg)
{
	// TODO: Add your specialized code here and/or call the base class


			if(pMsg->message ==WM_LBUTTONDOWN)
			{
				SendMessage(WM_LBUTTONDOWN,pMsg->lParam,pMsg->wParam);
			}

	return CView::PreTranslateMessage(pMsg);
}
I hope this will do.
shijith.

Message: 6
Date: Thu, 21 Oct 2004 16:36:36 +0800 (CST)
From: " zfjgo " <zfjgo at 126.com>
Subject: [vtkusers] How to interact?
To: vtkusers at vtk.org
Message-ID: <41777514.0000B9.31511 at m61.126.com>
Content-Type: text/plain; charset="gb2312"

Hello

I am attempting to interact with vtkRenderWindow,so I add the following VC++
code into my Project.But all the message have no response except WM_CHAR.
Why?
Do I need to overwrite them?How to do it ?

Thanks for your reply.



LRESULT CVtkSDIView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (message)
  {
    //case WM_PAINT:
    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MBUTTONDOWN:
    case WM_MBUTTONUP:
    case WM_RBUTTONDOWN:
    case WM_RBUTTONUP:
    case WM_MOUSEMOVE:
    case WM_CHAR:
    case WM_TIMER:
      if (this->iren->GetInitialized())
      {
        return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam,
this->iren);
      }
      break;
  }

  return CView::WindowProc(message, wParam, lParam);

}






More information about the vtkusers mailing list