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

FSXA Warning Panel Test Button

Messages
45
The code below is used to make certain parts visible on my warning panel, which it does do. Press the button...they all light up. Button stays in...lights stay on. Press button again...lights go off. Button returns to the out position.

How would I modify the code to press the button in and hold...parts stay visible...release the button or leave the button...button returns to normal position...warning lights go out.


Code:
        <PartInfo>
          <Name>Warning_Test_Button</Name>
          <AnimLength>50</AnimLength>
          <Animation>
            <Parameter>
                <Code>(L:lights test,bool) 50 *</Code>
            </Parameter>
          </Animation>
          <MouseRect>
            <Cursor>Hand</Cursor>
            <MouseFlags>LeftSingle+Leave</MouseFlags>
            <CallbackCode>
                (L:lights test,bool) ! (>L:lights test,bool)
            </CallbackCode>
            <Tooltip>Warning Panel Test Button</Tooltip>
          </MouseRect>
        </PartInfo>
 
Code:
<PartInfo>
    <Name>B222_switch_test_adf</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:B222_switch_test_adf, enum)
          if{ 10 }
          els{ 0 }
        </Code>
        <Lag>400</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>ADF Test</TooltipText>
      <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{
        1 (&gt;L:B222_switch_test_adf,enum)
        }
        (M:Event) 'LeftRelease' scmp 0 == if{ 0 (&gt;L:B222_switch_test_adf,enum) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

This should help you out ;)
 
Awesome...it works perfectly. Now on to the other 6 million switches and buttons and dials and...why am I doing this again?

Thank-you so much.
 
You can try using "Leave" instead of "LeftRelease" (in euroastar's example you would just replace the two "LeftRelease" with "Leave".

One problem with left release is that the user must still have their mouse in the mouse zone for it to to be true. If the user clicks and then drags the mouse out of the mouse zone before releasing then "LeftRelease" will not be true and your test switch will be stuck on until the user reclicks and left releases again.

"Leave" will be true when either the mouse is released or the user moves out of the mouse zone.

Try it out to see which you prefer.

Note: If you do use "Leave" then it changes the behaviour of "LeftSingle". Normally "LeftSingle" happens once, when the user clicks on the left mouse button. But, when "Leave" is used clicking on "LeftSingle" will occur then after a short while (about a second), if the user is holding the mouse button down, "LeftSingle" will repeat until the user releases the button. In your code this will not affect things but it is something to keep in mind.
 
Back
Top