I have a canvas with moveable and linkable objects on it. I can build a link between them by selecting one, clicking a button to set it as the source, then clicking another object and setting it as the destination. This is working fine, but it is clunky. I would like to be able to do a right click on the source to initiate drawing the link, then click on the destination object to complete the link.
I have a problem in that control-clicking on an object works, but right-clicking does not.
Does anyone have an idea what may be going wrong?
Here is part of the code in the MouseDown event handler. Thanks for any helpful suggestions you can offer.
if SelNode > 0 Then // node was selected from array of nodes on the Canvas
if WithinNode(SelNode) Then // mouse pointer is within the bounds of the object
if IsContextualClick Then
msgbox("Contextual Click")
else
msgbox("Left click")
end if
end if
end if
mousedown + isContextualClick works just fine for me in a Canvas and DesktopCanvas for right and control + left clicks.
Maybe move your debug test to top of event to ensure nothing else is exiting function.
Also double check your mouse / track pad actual are firing right clicks else where on macOS
If it were a mouse setup issue, wouldn’t it manifest in other programs beyond Xojo? Anyway, I had checked the Mouse settings and there is nothing amiss with left and right buttons. To make sure, I changed the button assignments there and the same problem remained, just swapping left for right.
It’s set up as right handed, and it’s a mouse (a Magic Mouse in fact) not a trackpad. I will see if I have another mouse with buttons knocking around, and if so I’ll try that.
//right mouse button?
if keyboard <> nil then
if keyboard.asynccontrolkey then
rbut = true
end if
end if
if IsContextualClick then
rbut = true
end if
has never failed to my knowledge.
I wonder if there is something odd in
if SelNode > 0 Then // node was selected from array of nodes on the Canvas if WithinNode(SelNode) Then// mouse pointer is within the bounds of the object
maybe see what happens here:
dim rbut as boolean
//right mouse button?
if keyboard <> nil then
if keyboard.asynccontrolkey then
rbut = true
end if
end if
if IsContextualClick then
rbut = true
end if
if rbut then
msgbox("Contextual Click")
else
msgbox("Left click")
end if
if SelNode > 0 Then // node was selected from array of nodes on the Canvas
if WithinNode(SelNode) Then // mouse pointer is within the bounds of the object
if rbut Then
msgbox("Contextual Click and selected")
else
msgbox("Left click and selected")
end if
end if
end if
Curiouser and curiouser. I will give that code a go, but in the meantime I have some information about mouse setup. The mouse I normally use is a rechargeable Bluetooth Magic Mouse, version 3.1.1, and the right click fails here. I also tried another Bluetooth Magic Mouse, (with AA batteries) version 3.0.6. Using this mouse my program responds to a right click as intended.
This week I set up a ConstructContextualMenu on a Canvas on a DesktopContainer plus a ConstructContextualMenu on the DesktopContainer itself. I found that I could only control-click the canvas and not right-click it to show the menu.
I removed the ConstructContextualMenu from the Canvas and left it for the DesktopContainer and it’s all working now ie do you have two ConstructContextualMenu’s that are conflicting?