if hitItem <> nil then
if hitItem.Text = "Cut" then
// do something
elseif hitItem.Text = "Copy" then
//do something
elseif hitItem.Text = "Paste" then
// 275% Zoom
// do something
end if
end if
Mike - Thanks, but I think you are missing the issue, which is that there’s a non-trivial difference in framework behavior between Win32 and Cocoa. My hunch is that the Cocoa behavior is different (e.g., code that I wrote that used to work in Win32 and Carbon is now behaving differently). Or it could simply be one of those “Different OSs are Different” situation.
Also: in MouseUp on Cocoa, IsContextualClick() works, but in MouseUp on Win32, it’s always False.
Seems buggy to me, but I wanted to solicit other opinions on what the actual bug is.
My Workaround so far:
Subclass the canvas
Add an ConstructContextualMenu handler:
return ConstructContextualMenu(base,x,y)
Add a new event
ConstructContextualMenu(base as MenuItem, x as integer, y as integer) as boolean
add a boolean flag bIgnoreMouseUp
In Canvas.MouseDown:
if IsContextualClick then
#if TargetWin32
bIgnoreMouseUp = true
dim base as new menuItem
if ConstructContextualMenu(base,x,y) then
call base.PopUp
end if
return True
#else
return false
#endif
In canvas.MouseUp:
#if TargetWin32
' on win32 we get these events when we shouldn't
if bIgnoreMouseUP then
bIgnoreMouseUp = false
return
end if
#endif
With these changes, the behavior becomes identical between Cocoa and Win32.
Except the question is not when, but whether the event will/should fire, and the difference between platforms. It really seems like it should be consistent.