I have the following code that correctly catches a Double Click on a rectangle inside a canvas, inside the canvas’s DoublePressed event:
//Check all rectangles on this canvas ( in mRects() )
//to see if we double clicked on one
For i As Integer = mRects.LastIndex DownTo 0
Var r As BITCObject = mRects(i)
If r.ClickedWithin(x, y) Then
mClickedRect = r
mRectIndex = i
Var w As New SettingsWindow
w.ShowPopover(me)
r.isSelected = true
End If
Next
This works perfectly.
I used the same code inside the ConstructContextualMenu event for the canvas, and a right click on a rectangle in the canvas never fires:
For i As Integer = mRects.LastIndex DownTo 0
Var r As BITCObject = mRects(i)
If r.ClickedWithin(x, y) Then
mClickedRect = r
// Build context menu
base.AddMenu(New MenuItem("Delete"))
base.AddMenu(New MenuItem("Change Color"))
base.AddMenu(New MenuItem("Duplicate"))
Return True
end if
next
If I put a break at the top of the ConstructContextualMenu event, it’s never triggered if I right click on a rectangle. But it is triggered if I click on the canvas outside a rectangle. Since the click is happening within the canvas (even though it’s on the rectangle within that canvas), and the ConstructContextualMenu event is for the canvas, shouldn’t this event get triggered like DoublePressed does?