• 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.

Can one program 'Long Press' into MouseRect?

Messages
10,163
Country
us-arizona
Hey all,

Can a person program in 'Long Press' into a MouseRect?

For instance, it normally does this when you click a button, but if you hold down the mouse for say 3 full seconds, it will do something else... Is that possible? If so, could you share how that is written in the mouse section code?

This would be pretty cool for changing speed readouts (digital) to metric, etc.
 
You should be able to.

Although you may find that you will require an additional background processing gauge to maintain it (I think you may be using one already anyway). I don't think you could do it all within one mouserect section.

I made a cowl flaps switch for my T-28 that requires the user to hold the switch down to continually move the cowl flaps. Using a (M:Event) 'RightSingle' scmp 0 == in the mouse rect I was able to set a L:VAR to indicate that the switch had been clicked. Using (M:Event) 'RightRelease' scmp 0 == I could reset that L:VAR back to zero. RightRelease is when you release the right mouse button. The additional gauge would then read the status of the L:VAR and if it was on it would move the cowl flaps.

Note how I used right clicks here as the switch was actually a threeway switch. Left click would move the switch to cowl flaps open, while right click was a spring loaded switch to close the cowl flaps (which is why you needed to hold the mouse button down, ie it was spring loaded)

The mouseflags I had to use were:
LeftSingle+RightAll

I needed the RightAll to handle the RightSingle and RightRelease conditions.

In your case you would use the mouserect to set the L:VAR to 1 when you get a 'LeftSingle' click and set L:VAR to 0 when you get 'LeftRelease'

Your additional gauge could then check if the L:VAR was greater than 0 and if so add 1 to it. Then check if the L:VAR is greater than 54 (your additional gauge will work at 18 ticks per second so 3 secs = 18 x 3) and if so do whatever function needs to be done and then reset the L:VAR back to zero.
 
Why not simply put a clickspot somewhere else on the gauge for switching between readouts?

Or, you know, always have a metric readout in the tooltip...
 
For instance, it normally does this when you click a button, but if you hold down the mouse for say 3 full seconds, it will do something else...

Actually you could add a timer that, after holding the button down for more than 3 seconds, would perform a given action.

I prefer to use a timer instead of the typical runtime cycle (18 times/second) because this last option doesn't work properly when the cycle is outside that value (because of slow frame rates or simulator rate different than 1x).

Tom
 
The chief problem with that sort of "dual-purpose" action is that the "short press event" will always take place immediately, and the "long press event" will of course only occur if one holds the mouse button down long enough.

The utility of such behavior truly depends on precisely what it is you are wanting to accomplish.
 
Back
Top