M
Matt
Hello all,
We have to customize context menu depending on the object selected.
And we use SpatialSearch to get the selected object. But it is not getting
the selected object always.
We we right click it is getting the object previously selected.
Following is what we did
We add the code
m_evtList.AddAdvise((short)Visio.VisEventCodes.visEvtCodeMouseDown,
m_evtSink, "", "");
And in VisEventProc, we add the following code
case (short)VisEventCodes.visEvtCodeMouseDown :
{
//Handle the MouseDown event.
myView.OnMouseDown(source, subject);
break;
}
And on onMousedown
public void OnMouseDown(object source, object subject)
{
// Find object behind mouse position
vsoPage = vsoApp.ActivePage;
Selection sel = vsoPage.get_SpatialSearch(lastMouseMoveEvent.x,
lastMouseMoveEvent.y,
(short)VisSpatialRelationCodes.visSpatialContainedIn,
..001,
(short)VisSpatialRelationFlags.visSpatialIncludeHidden);
// sel.count is 0 sometimes.
}
Is there any fix/ workaround for the issue
Please help
Matt
We have to customize context menu depending on the object selected.
And we use SpatialSearch to get the selected object. But it is not getting
the selected object always.
We we right click it is getting the object previously selected.
Following is what we did
We add the code
m_evtList.AddAdvise((short)Visio.VisEventCodes.visEvtCodeMouseDown,
m_evtSink, "", "");
And in VisEventProc, we add the following code
case (short)VisEventCodes.visEvtCodeMouseDown :
{
//Handle the MouseDown event.
myView.OnMouseDown(source, subject);
break;
}
And on onMousedown
public void OnMouseDown(object source, object subject)
{
// Find object behind mouse position
vsoPage = vsoApp.ActivePage;
Selection sel = vsoPage.get_SpatialSearch(lastMouseMoveEvent.x,
lastMouseMoveEvent.y,
(short)VisSpatialRelationCodes.visSpatialContainedIn,
..001,
(short)VisSpatialRelationFlags.visSpatialIncludeHidden);
// sel.count is 0 sometimes.
}
Is there any fix/ workaround for the issue
Please help
Matt