Page 2 of 2
Re: Problem with menu in gridview
Posted: Tuesday 2nd April 2024 11:24am
by thatbruce
Ah Grasshopper! Again you have failed to respect history. Olde tyme myce had only two buttons (there is some pre-history regarding a "one button mouse" but that can be disregarded) hence the numbering.
b
Re: Problem with menu in gridview
Posted: Tuesday 2nd April 2024 11:57am
by BruceSteers
Is it the same for Mouse.State?
Dang it, now i need a 2 button mouse to test with.
And I gotta think of a workaround now :-\
Best i can think of is this,,
Note the Mouse.Button value on MouseDown and then use the _Menu() event to set it.
But the _Menu event needs to fire before it's known.
Private $iRightButton as Integer = -1
Private $iCurrentButton as Integer
Public Sub Form_MouseDown()
$iCurrentButton = Mouse.Button
End
Public Sub Form_Menu()
If $iRightButton = -1 Then
$iRightButton = $iCurrentButton
Endif
End
Then i know if $iRightButton <> -1 then the Right (menu) button is known.
Darn i wish things were simpler
Re: Problem with menu in gridview
Posted: Tuesday 2nd April 2024 1:27pm
by bill-lancaster
My centre button returns mouse.button=3 and Right click gives Mouse.Right=True.
Re: Problem with menu in gridview
Posted: Tuesday 2nd April 2024 2:10pm
by BruceSteers
bill-lancaster wrote: ↑Tuesday 2nd April 2024 1:27pm
My centre button returns mouse.button=3 and Right click gives Mouse.Right=True.
Be careful using Mouse.Left and Mouse.Right though Bill as they are more like button "down" registers than button "click".
Ie , if you press left button while right button is also held down then Mouse.Right will be true with the left click. (if that makes sense)
Aah I just discovered this could just be a QT/GTK thing.
Seems Right and Middle button value is inverted with QT5 and GTK3
With QT5 Mouse.Button = 2 for Right 3 for Middle
With GTK3 Mouse.Button = 3 for Right 2 for Middle
So the code could possibly just be like this (to ensure is correct on both toolkits)
(no idea what wayland uses)
Private $iRight As Integer = 2
Private $iMiddle As Integer = 3
Public Sub Form_Open()
If Component.IsLoaded("gb.gtk") Or If Component.IsLoaded("gb.gtk3") Then
$iRight = 3
$iMiddle = 2
Endif
End
Public Sub Form_MouseDown()
If Mouse.Button = 1 Then
Print "Click was Left"
Else If Mouse.Button = $iRight Then
Print "Click was Right"
Else If Mouse.Button = $iMiddle Then
Print "Click was Middle"
Endif
End
PS. apologies Bill for slightly hijacking this thread with my outrageous need for accuracy
But i hope you have got some good stuff out of it (i know I did)
Re: Problem with menu in gridview
Posted: Wednesday 3rd April 2024 9:19am
by bill-lancaster
Not a problem Bruce.
Peculiar behavior of gridview and mouse fully explored!
Bill