[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mouse.Button , ensure correct right button value
[Thread Prev] | [Thread Next]
- Subject: Re: Mouse.Button , ensure correct right button value
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Tue, 2 Apr 2024 13:55:13 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On Tue, 2 Apr 2024 at 13:35, Gianluigi <gradobag@xxxxxxxxxxx> wrote: > Il 02/04/24 14:20, Bruce Steers ha scritto: > > Private $iRight As Integer = -1 > > > > Public Sub Form_MouseDown() > > > > If $iRight = -1 Then > > Select Mouse.Button > > Case 2 > > If Mouse.Right And If Not Mouse.Middle Then $iRight = 2 Else > > $iRight = 3 > > Case 3 > > If Mouse.Right And If Not Mouse.Middle Then $iRight = 3 > > End Select > > Endif > > > > End > > > > Then once $iRight is not -1 i know exactly what Mouse.Button is right > click > > maybe you will find safer: > > Public Sub Form_MouseDown() > > If Mouse.Left And If Mouse.Right Then Return > If Mouse.Left Then > Print "You pressed on the left button!" > Return > Else If Mouse.Right Then > Print "You pressed on the right button!" > Return > Endif > > End > > Regards > Gianluigi Not really, I think it's less safe than my code. (c'mon Gian, you gotta know if i'm asking here the answer probably is not quite that simple) :) If multiple buttons are pressed then the click detection can be missed. With your code if right mouse button is clicked while holding left down it will fail to detect the right click. I think with my code if mouse right and mouse middle are pressed together it can also miss. but it only misses determining right button value. once right button value is known i can use it to confidently detect what was clicked with "If Mouse.Button = $iRightValue" Using Mouse.Button is the better option in this situation than Mouse.State or Mouse.Left/Mouse.Right etc but determining if Right is Mouse.Button 2 or 3 is the issue. A Property like Mouse.RightButtonValue could be useful Respects BruceS
Re: Mouse.Button , ensure correct right button value | Bruce Steers <bsteers4@xxxxxxxxx> |
Mouse.Button , ensure correct right button value | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: Mouse.Button , ensure correct right button value | Gianluigi <gradobag@xxxxxxxxxxx> |
Re: Mouse.Button , ensure correct right button value | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: Mouse.Button , ensure correct right button value | Gianluigi <gradobag@xxxxxxxxxxx> |