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

FSX Multiple ClickType

Messages
371
Country
france
Hi,

I would like to get a mouse area which execute different code according the click type.

This is for the Autopilots knobs. The original code has only left click event. If I replace the click by the right clik, code works.

But if I want detect multiple click type, code doesn't work.


Code:
<MouseArea id="HDG Knob Push-Pull">
	<FloatPosition>82.000,43.000</FloatPosition>
	<Size>9,33</Size>
	<CursorType>Hand</CursorType>
	<MouseClick id="MouseClick">
		<Script>
			(M:Event) 'RightSingle' scmi 0 == (L:Knob_HDG,bool) 0 == and (A:Autopilot heading lock, bool) 0 == and if{ 1 (>K:AP_PANEL_HEADING_ON) -1 (>L:HDG_Knob_PP,number) }
			(M:Event) 'RightSingle' scmi 0 == (L:Knob_HDG,bool) 1 == and if{ 0 (>L:Knob_HDG,bool) 1 (>K:AP_PANEL_HEADING_ON) -1 (>L:HDG_Knob_PP,number) } 
			(M:Event) 'LeftSingle' scmi 0 == (L:Knob_HDG,bool) 1 == and if{ 1 (>L:Knob_HDG,bool) 1 (>L:HDG_Knob_PP,number) }
			(M:Event) 'LeftSingle' scmi 0 == (L:Knob_HDG,bool) 0 == and if{ 1 (>L:Knob_HDG,bool) 1 (>K:AP_PANEL_HEADING_OFF) 1 (>L:HDG_Knob_PP,number) }
			(M:Event) 'RightRelease' scmi 0 == if{ 0 (>L:HDG_Knob_PP,number) }
			(M:Event) 'LeftRelease' scmi 0 == if{ 0 (>L:HDG_Knob_PP,number) }
		</Script>
	</MouseClick>
	<Tooltip id="Tooltip HDG Push-Pull">
		<DefaultScript>HDG Hold - Leftt click Pushed=Managed    Right Click Pulled=Selected</DefaultScript>
	</Tooltip>
</MouseArea>

Is it impossible to detect different mouse clicktype in one area ?
 
You really only have the following from which to choose:

LeftClick
MiddleClick
RightClick
WheelUp
WheelDown

These have limited use normally:
LeftRelease
MiddleRelease
RightRelease

LeftDrag
MiddleDrag
RightDrag

You can easily combine mouse clicks with other conditions to enable Left/Middle/Right clicking to do different things based on say whether a knob is pulled out or pushed in.

There are many ways to make any control "multi-function." Here is an example where the same button takes five different actions based on other variable settings:

Code:
    <Area Name="XFR Button" Left="321" Top="105" Width="34" Height="25">
      <Click Kind="LeftSingle+RightSingle">
        (M:Event) 'LeftSingle' scmp 0 ==
        if{
        <!-- SWAP COM FREQS -->
        (L:Garmin_com_field_toggle,bool) ! (L:RmtFUNC,enum) 2 == and if{ (>K:COM_STBY_RADIO_SWAP) }
        (L:Garmin_com_field_toggle,bool) 1 == (L:RmtFUNC,enum) 2 == and if{ (>K:COM2_RADIO_SWAP) }
        <!-- SWAP NAV FREQS -->
        (L:Garmin_nav_field_toggle,bool) ! (L:RmtFUNC,enum) 3 == and if{ (>K:NAV1_RADIO_SWAP) }
        (L:Garmin_nav_field_toggle,bool) 1 == (L:RmtFUNC,enum) 3 == and if{ (>K:NAV2_RADIO_SWAP) }
        }
        <!-- SET COM1 EMERGENCY FREQ -->
        (M:Event) 'RightSingle' scmp 0 == if{
        (L:RmtFUNC,enum) 2 ==
        if{ @SetCOM1Emerg } }
        1 (&gt;L:XMLClick,enum)
      </Click>
      <Cursor Type="Hand"/>
      <Tooltip>XFR Func</Tooltip>
    </Area>

Another way is to use <Visible> conditions to control which of several actions a mouse event might take. Here the same knob takes four different tuning functions:

Code:
    <!-- COM1 Outer Knob -->
    <Area Left="220" Top="42" Width="64" Height="64">
      <Visible>(L:COM_Tune,enum) 1 ==</Visible>
      <Cursor Type="Hand"/>
      <MouseWheelUp>(>K:COM_RADIO_WHOLE_INC)</MouseWheelUp>
      <MouseWheelDown>(>K:COM_RADIO_WHOLE_DEC)</MouseWheelDown>
      <Tooltip>Com1 Tune</Tooltip>
    </Area>

    <!-- COM2 Outer Knob -->
    <Area Left="220" Top="42" Width="64" Height="64">
      <Visible>(L:COM_Tune,enum) 2 ==</Visible>
      <Cursor Type="Hand"/>
      <MouseWheelUp>(>K:COM2_RADIO_WHOLE_INC)</MouseWheelUp>
      <MouseWheelDown>(>K:COM2_RADIO_WHOLE_DEC)</MouseWheelDown>
      <Tooltip>Com2 Tune</Tooltip>
    </Area>

    <!-- NAV1 Outer Knob -->
    <Area Left="220" Top="42" Width="64" Height="64">
      <Visible>(L:NAV_Tune,enum) 1 ==</Visible>
      <Cursor Type="Hand"/>
      <MouseWheelUp>(>K:NAV1_RADIO_WHOLE_INC)</MouseWheelUp>
      <MouseWheelDown>(>K:NAV1_RADIO_WHOLE_DEC)</MouseWheelDown>
      <Tooltip>Nav1 Tune</Tooltip>
    </Area>

    <!-- NAV2 Outer Knob -->
    <Area Left="220" Top="42" Width="64" Height="64">
      <Visible>(L:NAV_Tune,enum) 2 ==</Visible>
      <Cursor Type="Hand"/>
      <MouseWheelUp>(>K:NAV2_RADIO_WHOLE_INC)</MouseWheelUp>
      <MouseWheelDown>(>K:NAV2_RADIO_WHOLE_DEC)</MouseWheelDown>
      <Tooltip>Nav2 Tune</Tooltip>
    </Area>
 
Hi N4gix,

Thank you for your answer.

A thing that I don't understand is the "<Area>" tag.

I can write a section <Area> </Area> like a child object of my <MouseArea> ?

or I must place this section outside the MouseArea section ?

This is the <Area> that is trouble for me ! I don't know this tag. I have always use <MouseArea>
 
Last edited:
It's a syntax difference between FS9 XML Schema and FSX XML Schema. The two tags mean the same thing, but must only be used in their respective context.

I refuse to use the FSX XML Schema simply because I can write the same script with 30% less lines because it is more efficient.

On the other hand, if you use the FSX "ACES" tool, you have no choice but to use the FSX XML Schema.

Both my examples are in the FS9 XML Schema of course, but the principles are the same.
 
Thanks,

I don't use ACES. I write all with the hand with notepad++.

So, if I understand, I can keep the same sheme that my first post with the <MouseArea> tag.

I will try.

Thank you
 
Last edited:
ACES or by hand, you are nonetheless using the FSX XML Schema and Syntax... ;)
 
yes, because it is the only one I know. I started xml at the beginning of the year with the microsoft ESP website, and I only have FSX .

That is the reason why I don't know the FS9 synthx.

Thanks again

Francois
 
For your purposes, the only stuff of interest is between the <Click...> and </Click> tags in my examples. That is the essential logic of the script.

For the rest simply use your existing FSX Syntax examples...
 
Thanks.

I will test tomorrow , because today, I have realized another part of the gauge.

I'll give you feedback

Francois
 
Back
Top