XML MouseRect problem

n4gix

Resource contributor
#1
I have encountered an issue that defies all of my attempts to resolve. I have multiple switches that are 3 position, center return. They are various 'trimming' switches that are left/right click, with spring-loaded center return. Most of them work as designed, however two simply do not. Here is the XML script for one that works:
Code:
  <PartInfo>
    <Name>ATR_ENG1_TRIM_SWITCH</Name>
    <AnimLength>20</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:ENG1_TRIM_SWITCH, number) 1 + 10 *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle+RightSingle+LeftRelease+RightRelease</MouseFlags>
      <CallbackCode>
        (M:Event) &apos;LeftSingle&apos; scmp 0 == if{ 0x1129D (&gt;L:LVEVENT, number) }
        (M:Event) &apos;RightSingle&apos; scmp 0 == if{ 0x1129E (&gt;L:LVEVENT, number) }
        (M:Event) &apos;LeftRelease&apos; scmp 0 == if{ 0x1129E (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
        (M:Event) &apos;RightRelease&apos; scmp 0 == if{ 0x1129D (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
Here is one that does not work properly.
When left-clicked, switch moves to the left position, on release it returns to center position.
When right-clicked, switch moves to right position, on release it snaps back to the left position! :eek:

Code:
  <PartInfo>
    <Name>ATR_ENG1_LO_PITCH_SWITCH</Name>
    <AnimLength>20</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:ENG1_LO_PITCH_SWITCH, number) 1 + 10 *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle+RightSingle+LeftRelease+RightRelease</MouseFlags>
      <CallbackCode>
        (M:Event) &apos;LeftSingle&apos; scmp 0 == if{ 0x112A3 (&gt;L:LVEVENT, number) }
        (M:Event) &apos;RightSingle&apos; scmp 0 == if{ 0x112A4 (&gt;L:LVEVENT, number) }
        (M:Event) &apos;LeftRelease&apos; scmp 0 == if{ 0x112A4 (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
        (M:Event) &apos;RightRelease&apos; scmp 0 == if{ 0x112A3 (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Last edited:

tgibson

Resource contributor
#2
Hi,

1. Try a shorter part name and L: variable name.
2. Try a different name for the part name and L: variable name. Change it so ATR_ENG1 and ENG1 are not the start of the names.
3. Make sure you remove any scaling from the part.
 
#3
I went through your code and nothing jumps into my eyes. Maybe it's something with the linked code - I guess a C++ gauge?

Is it on purpose that you use 1 (&gt;L:LVEVRELEASE, number) both for Left and Right release?
 

n4gix

Resource contributor
#4
I went through your code and nothing jumps into my eyes. Maybe it's something with the linked code - I guess a C++ gauge?

Is it on purpose that you use 1 (&gt;L:LVEVRELEASE, number) both for Left and Right release?
Another team member is coding an Event Handler in a .dll so the issue might lie in his code. I haven't tried yet but I'll bet that if I temporarily re-tag the non-working switch with the working switch's hex number it will work properly. That would definitely point to his .dll code.

Yes, the 1 (&gt;L:LVEVRELEASE, number) is a generic release event.
 

n4gix

Resource contributor
#6
It's always good when you can cast blame on someone else! :rotfl::rotfl:
In this instance it has been confirmed. Both of the two misbehaving switches animate properly when driven by the working script(s). So the problem does lie in the .dll coding. :scratchch
 
Top