In a DesktopCanvas I can make appear a contextual menu just simply pressing the shift key and then move the mouse into the canvas, by adding this code in the Canvas event ‘MouseEnter’:
If Keyboard.AsyncShiftKey Then Var popMenu As DesktopMenuItem popMenu = EditMenu.Clone Var selectedMenu As DesktopMenuItem selectedMenu = popMenu.Popup if selectedMenu <> nil then if selectedMenu.text = "&Undo" then TextField1.text= selectedMenu.text end end End If
Now, if I do nothing (=meaning I do not click anywhere and move the mouse outside of the canvas control, I would like the contextual menu to disappear.
I tried in different ways, but I couldn’t managed that. Any suggestion ?
I could consider to combine a Timer + checking for the mouse position and ‘simulating’ the pression of the ‘esc’ key, but I wonder if I can take advantage of the event ‘MouseExit’ or other simpler options.