[Gambas-bugtracker] Bug #2586: mouse.right or left don't have difference...

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sun Jul 17 17:26:49 CEST 2022


Comment #3 by Bruce STEERS:

I think m0 is only invalid on the first click.
once the menu's have been created and attached to the form they exist until you destroy them. (probably something like that)

Try either moving the "If m0 then m0.PopUp()" line up 1 to before the Endif line. Because the error here is not to do with Mouse.Right/Mouse.Left but your "If m0" condition is the problem being outside of the Mouse.Right condition.

Or better, start the dpopmenu() method with "If Not Mouse.Right Then Return"

Or even better use the condition in the MouseDown() Event (Probably better to use MouseUp() as it gives the user the chance to move away from the control and not trigger it)

Public Sub Form_MouseUp()

  If Not Mouse.Inside(Me) Then Return ' User moved the mouse away before letting button go.
  If Mouse.Right Then dpopmenu    ' only run dpopmenu if mouse.right


You should join the gambas mailing list as it is a good place to ask first if you have found a bug or if you are coding it wrong before reporting things here.

Well wishes

More information about the Bugtracker mailing list