RemoteControlMBS.WinMouseClick always triggers a right click when using two buttons parameters, even if the second one is false

Hello,

The code below is supposed to produce a left click on Windows:

dim x,y As Integer

x=System.MouseX
y=System.MouseY

call RemoteControlMBS.WinMouseClick(x,y,True,True,False) 'Absolute position, left button, right button
call RemoteControlMBS.WinMouseClick(x,y,True,False,False) 'Absolute position, left button, right button

(note the last boolean, for the right button, is always false here).
In my tests, however, the code above triggers both the left and the right buttons, as I can see a contextual menu showing (and I’ve proven the left mouse button is also pressed).

Using the function with one less parameter, like the following example, works as expected and only the left button is pressed:

dim x,y As Integer

x=System.MouseX
y=System.MouseY

call RemoteControlMBS.WinMouseClick(x,y,True,True) 'Absolute position, left button
call RemoteControlMBS.WinMouseClick(x,y,True,False) 'Absolute position, left button

I recognise the latter is more logical to use (though not always), but still, the former has a bug, as False means “leave the button up).

Should this be fixed or I’ve not understood correctly?

@Christian_Schmitz

1 Like

Well, passing false for a button makes a mouse up for that.

Sounds like we may better need an integer instead of a boolean, so you can decide whether you want mouse up, down or nothing for a button, right?

1 Like

That’s the actual problem: with “call RemoteControlMBS.WinMouseClick(x,y,True,False,False)”, the last parameter makes no difference; even when false, the right button is pressed, as if the parameter was true.

If that’s doable with the calls you have, then that’d be ideal, indeed. Existing behaviours would continue to work and ignoring would be easier.

Thank you, Christian.

I’ll add an integer version.

1 Like

Thank you.
Do you plan to fix the existing call (where “false” is treated as “true” with 2 buttons parameters)?

No, I can’t change it as someone else may use it.

Ok. Then, perhaps, mentioning it in the documentation would be a good idea, as I, for one, spent some time figuring out this bug.
Thank you.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.