• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Mouse button question

DragonflightDesign

Resource contributor
Messages
1,390
Country
northernireland
Given the standard mouse definitions
Code:
#define MOUSE_RIGHTSINGLE   BIT31
#define MOUSE_MIDDLESINGLE  BIT30
#define MOUSE_LEFTSINGLE    BIT29
#define MOUSE_RIGHTDOUBLE   BIT28
#define MOUSE_MIDDLEDOUBLE  BIT27
#define MOUSE_LEFTDOUBLE    BIT26
#define MOUSE_RIGHTDRAG     BIT25
#define MOUSE_MIDDLEDRAG    BIT24
#define MOUSE_LEFTDRAG      BIT23
#define MOUSE_MOVE          BIT22
#define MOUSE_DOWN_REPEAT   BIT21
#define MOUSE_RIGHTRELEASE  BIT19
#define MOUSE_MIDDLERELEASE BIT18
#define MOUSE_LEFTRELEASE   BIT17
#define MOUSE_WHEEL_FLIP    BIT16   // invert direction of mouse wheel
#define MOUSE_WHEEL_SKIP    BIT15   // look at next 2 rect for mouse wheel commands
#define MOUSE_WHEEL_UP      BIT14
#define MOUSE_WHEEL_DOWN    BIT13
#define MOUSE_MOVE_REPEAT   BIT12   // if used with MOUSE_*DRAG generates MOVE_MOVE every so often
#define MOUSE_LEAVE         BIT11   // to be used with MOUSE_DOWN_REPEAT
#define MOUSE_GETALL        BIT10   // used to get all mouse messages happend over the rect
#define MOUSE_LEFTALL       (MOUSE_LEFTSINGLE | MOUSE_LEFTDRAG | MOUSE_LEFTRELEASE)
#define MOUSE_RIGHTALL      (MOUSE_RIGHTSINGLE | MOUSE_RIGHTDRAG | MOUSE_RIGHTRELEASE)
#define MOUSE_MIDDLEALL     (MOUSE_MIDDLESINGLE | MOUSE_MIDDLEDRAG | MOUSE_MIDDLERELEASE)
#define MOUSE_WHEEL         (MOUSE_WHEEL_DOWN|MOUSE_WHEEL_UP)
I would have thought that
Code:
#define MOUSE_BOTH_DOWN  (MOUSE_LEFTSINGLE & MOUSE_RIGHTSINGLE)
or perhaps this:
Code:
#define MOUSE_BOTH_DOWN  (MOUSE_LEFTSINGLE & MOUSE_RIGHTSINGLE & MOUSE_DOWN_REPEAT)
would get both buttons being pressed together (and/or being held down) but it doesn't. What did I misunderstand about adding the bits together?
 
BIT29 AND BIT31 does not equal anything. You just "anded" the bits... and they don't line up... so, you end up with a 0.
 
WarpD is right. I think you can use (MOUSE_LEFTSINGLE | MOUSE_RIGHTSINGLE)
It will probably be true if left or mouse button is pressed, so I am not sure it is what you are looking for...
 
Thanks Ed, Eric. I already have a workaround that detects both buttons down at the same time but it's clunky and I was hoping for something simpler. In my current project I've made quite a lot of use of MOUSE_MIDDLESINGLE but as Ed pointed out in another thread, I shouldn't rely on everyone having a working middle mouse button. I'm recoding so that middleclick OR both buttons down will have the same effect.
 
Ok... the flags are used to tell the sim what mouse events you want to be notified of. No more, no less. It's really just that simple. What you DO with that is up to you. If your code wants to do something when both the left AND the right mouse button are being pressed... you have to do all the heavy lifting. You have to ask to be notified of the mouse down, the mouse up, the mouse leave... at the minimum... for both buttons and then track their state.
 
My workaround does that. It also recognises which button was pressed first so you can add actions when the other button is detected as being pressed also. I'm grateful for the confirmation that there's no other way of doing it.
 
Back
Top