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

P3D v3 Screen/Mouse Left Swipe, Right Swipe, Down Swipe

Messages
10,088
Country
us-arizona
Is it possible... Has anyone figured out a way... to do this..
to 'Mouse drag' a Left Swipe, Right Swipe, Down Swipe, Up Swipe, on a gauge face?
 
Messages
10,088
Country
us-arizona
Left Drag means left-mouse-button-drag... and right drag means 'right-mouse-button-drag' movements. Not exactly the same as dragging the mouse with the left click button, left, across the screen, or right, across the screen, meaning from left to right (for right drag) and right to left (for left drag). Same for up and down dragging. So, no... not the same. :(

This would be where you click on the area on the gauge, and make a left-mouse-button-down-click (drag) motion, either up, down, left, or right motion, of any amount, in that zone, and it would trigger an enum code string.
 
Messages
440
Country
us-wisconsin
Dragging & swiping are kind of the same except,,, you need to know the direction.
Just an idea based on a lua made for FS9 to do FSX style looking around.
Not tested.

1) Need to know the original position of the initial click without the release
Code:
<Click Kind="LeftSingle+LeftDrag">
(M:X) (>L:Init_Click_X, number)
(M:Y) (>L:Init_Click_Y, number)
</Click>

2) Need to have a little "cushion" so that even a heartbeat upon the mouse will not have a directional effect.
Code:
<!-- In pixels relative to parent object/gauge background -->
<Macro Name="Cushion">20</Macro>


3) Add all the requisites together. This is for a 2D gauge but in a VC should be able to do too.
On the initial click, get the X/Ys, after that get the XY's during the drag and compare to the initials applying the cushion.
Code:
<Macro Name="Cushion">20</Macro>

<Mouse>

<Click Kind="LeftSingle+LeftDrag">
<!-- Get Initials -->
(M:Event) 'LeftSingle' scmp 0 ==
if{ (M:X) (>L:Init_Click_X, number) (M:Y) (>L:Init_Click_Y, number) }

<!-- Do the comparisons and apply -->

els{ (M:Event) 'LeftDrag' scmp 0 == if{
<!-- Swipe left -->
(M:X) @Cushion + (L:Init_Click_X, number) &lt; if{ DO MY LEFT SWIPE STUFF }
<!-- Swipe right -->
(M:X) @Cushion - (L:Init_Click_X, number) &gt; if{ DO MY RIGHT SWIPE STUFF }
<!-- Swipe down -->
(M:Y) @Cushion + (L:Init_Click_Y, number) &lt; if{ DO MY DOWN SWIPE STUFF }
<!-- Swipe up -->
(M:Y) @Cushion - (L:Init_Click_Y, number) &gt; if{ DO MY UP SWIPE STUFF }

<!-- End comparison els -->
} }

</Click> 

</Mouse>
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
Left Drag means left-mouse-button-drag... and right drag means 'right-mouse-button-drag' movements. Not exactly the same as dragging the mouse with the left click button, left, across the screen, or right, across the screen, meaning from left to right (for right drag) and right to left (for left drag). Same for up and down dragging. So, no... not the same. :(

This would be where you click on the area on the gauge, and make a left-mouse-button-down-click (drag) motion, either up, down, left, or right motion, of any amount, in that zone, and it would trigger an enum code string.

As Roman pointed out, it's very much the same as long as you consider the drag direction in the code.
 
Messages
10,088
Country
us-arizona
So how would this be written? Is there such a code that says what direction you are dragging and then releasing? I have never seen such a code.

On a 3D Model in FS, I was able to have a mouse control that could open/close a canopy (slide an object) by moving the mouse sideways. This was for the ModelDef parts though, not a 2D XML gauge.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Bill, here is an example of using LeftDrag to control a mixture lever. It also allows for mouse wheel for fine adjustments if desired:
Code:
  <PartInfo>
    <Name>KA350i_lever_mixture0</Name>
    <Copy>KA350i_lever_mixture_both</Copy>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:GENERAL ENG MIXTURE LEVER POSITION:1,enum)
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>L Cond %((L:GENERAL ENG MIXTURE LEVER POSITION:1,enum))%!d!</TooltipText>
      <MouseFlags>LeftSingle+LeftDrag+MoveRepeat+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 !=
        if{
        (L:ConditionLeftX, position) s0 0 !=
        if{
        (L:GENERAL ENG MIXTURE LEVER POSITION:1,enum) (M:X) l0 &lt;
        if{ 2 + 100 min } els{ l0 (M:X) &lt; if{ 2 - 0 max } }
        (&gt;L:GENERAL ENG MIXTURE LEVER POSITION:1,enum)
        }
        }
        (M:X) (&gt;L:ConditionLeftX, position)

        (M:Event) 'WheelDown' scmp 0 !=
        if{ (L:GENERAL ENG MIXTURE LEVER POSITION:1,enum) ++ (&gt;L:GENERAL ENG MIXTURE LEVER POSITION:1,enum) }
        (M:Event) 'WheelUp' scmp 0 !=
        if{ (L:GENERAL ENG MIXTURE LEVER POSITION:1,enum) -- (&gt;L:GENERAL ENG MIXTURE LEVER POSITION:1,enum) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Messages
10,088
Country
us-arizona
Bill,

My apologies. I might have worded that wrong. I am looking for a 2D gauge code.

What I want to do is mouse drag pages on a digital LCD screen.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
The "M:" type variable x and y parameters deal with the on screen coordinates and NOT the world coordinates. So FSX doesn't care one bit if a mouse drag code is run in a 2D or a 3D control element.
This is also the reason why mouse draggable handles in the VC are so awfully tricky to implement. What works from viewpoint A will not work that well from viewpoint B, simply because you're only dealing with X and Y coordinates.
 
Top