Hi
I do encountered the same problem on Context menu, if anyone has the solution to Zoom, Pan and Cursor placement pls do let me know. And one more thing is how do i reset to actual display after zooming or panning. Can anyone suggest on this.
here is the code how i handle context menu..
/**********************************************/
void CTest_DataView::onMouseDownOnGraph(short Button, short Shift, long x, long y)
{
int tempX = x + 120;
int tempY = y + 110;
CString str = "";
if(Button == 2)
{
CMenu sGrphMenu;
sGrphMenu.CreatePopupMenu();
sGrphMenu.AppendMenu(MF_STRING | MF_ENABLED, IDM_CURSOR,"Cursor");
sGrphMenu.AppendMenu(MF_STRING | MF_ENABLED, IDM_ZOOM, "Zoom");
sGrphMenu.AppendMenu(MF_STRING | MF_ENABLED, IDM_PAN, "Pan");
sGrphMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY, tempX, tempY, this );
}
}
LRESULT CTest_DataView::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if(message == WM_COMMAND)
OnRButtonMenuCmd(wParam);
return CFormView::DefWindowProc(message, wParam, lParam);
}
void CTest_DataView::OnRButtonMenuCmd(UINT CMD_ID)
{
switch(CMD_ID)
{
case IDM_CURSOR:
m_Graph.SetTrackMode(CNiGraph::TrackDragCursor);
break;
case IDM_ZOOM:
m_Graph.SetTrackMode(CNiGraph::TrackZoomRectXY);
break;
case IDM_PAN:
m_Graph.SetTrackMode(CNiGraph::TrackPanPlotAreaXY);
break;
}
}
/**********************************************/
Thanks & regards
venky