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

FS2004 Custom Tooltips... Tips!: INFO

Messages
1,451
Country
mexico
Hello friends:

In my constant struggle with XML code, I found some issues; among them; the Tooltip codes. By experimentation, I had some ideas and want to share them with all of you. This is aimed for those who are beginning to understand XML subtleties (like me); however, for seasoned programmers, this might be overkilling.

CUSTOM TOOLTIPS:
Tooltips will show a custom text when the mouse is hovering over a region defined within the mouse area code.
If non of default Help IDs is what you want to display, there is a workaround: Use conditional text techniques along A:Vars and/or L:Vars !!!

For this particular case, I want to display:
CRS 1 in degrees when NAV1 is selected as source and
CRS 2 in degrees when NAV2 is selected
(L:SK407_HSI_NAV_Source,bool) is a custom L:Var which is used to toggle between NAV1 and NAV2.

Particularly, I don't like long text strings, because they are hard to read and understand. However, tooltips behaves slightly different than a regular string:
they don't like white spaces between code lines! That's why I did some preparations before to use the "code version" (see the code below):

HTML:
"Course" Custom Tooltip Setup:
<Tooltip>
%((L:SK407_HSI_NAV_Source,bool))
%{if}
CRS 2: %((A:NAV2 OBS,degrees))%!03.0f!
%{else}
CRS 1: %((A:NAV1 OBS,degrees))%!03.0f!
%{end}
</Tooltip>

In order to use this tooltip, it is desirable to eliminate all white spaces in the "code version":
HTML:
"Course" Tooltip to be used within the gauge code itself:
<Tooltip>%((L:SK407_HSI_NAV_Source,bool))%{if}CRS 2: %((A:NAV2 OBS,degrees))%!03.0f!%{else}CRS 1: %((A:NAV1 OBS,degrees))%!03.0f!%{end}</Tooltip>

I will show three custom mouse areas where I used this "technique":
HTML:
  <!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                            -->
      <Mouse>
      <!-- NAV1 / NAV2 Source Toggle -->
          <Area Left="340" Top="677" Width="127" Height="127">
          <Tooltip>NAV1/NAV2 Source Toggle</Tooltip>
              <Cursor Type="Hand"/>
              <Click>(L:SK407_HSI_NAV_Source,bool) ! (&gt;L:SK407_HSI_NAV_Source,bool)</Click>
          </Area>
      <!-- Course Knob -->
          <Area Left="27" Top="538" Width="127" Height="127">
              <Tooltip>%((L:SK407_HSI_NAV_Source,bool))%{if}CRS 2:%((A:NAV2 OBS,degrees))%!03.0f!%{else}CRS 1:%((A:NAV1 OBS,degrees))%!03.0f!%{end}</Tooltip>
              <!-- CRS DEC-->
              <Area Right="60">
                  <Cursor Type="DownArrow"/>
                  <Click Repeat="Yes">
                      (L:SK407_HSI_NAV_Source,bool)
                            if{ (>K:VOR2_OBI_DEC) }
                          els{ (>K:VOR1_OBI_DEC) }
                  </Click>
              </Area>
              <!-- CRS INC-->
              <Area Left="66">
                  <Cursor Type="UpArrow"/>
                  <Click Repeat="Yes">
                      (L:SK407_HSI_NAV_Source,bool)
                            if{ (>K:VOR2_OBI_INC) }
                          els{ (>K:VOR1_OBI_INC) }
                  </Click>
              </Area>
          </Area>
      <!-- Heading Knob -->
          <Area Left="593" Top="538" Width="127" Height="127">
          <ToolTip>HDG: %((A:Plane heading degrees gyro,degrees))%!03.0f!</ToolTip>
              <!-- HDG DEC-->
              <Area Right="60">
                  <Cursor Type="DownArrow"/>
                  <Click Event="HEADING_BUG_DEC" Repeat="Yes"/>
              </Area>
              <!-- HDG INC-->
              <Area Left="66">
                  <Cursor Type="UpArrow"/>
                  <Click Event="HEADING_BUG_INC" Repeat="Yes"/>
              </Area>
          </Area>
      </Mouse>

Now, the final result within the simulator.
When NAV1 is selected:
Custom_Tooltips_NAV1.jpg


When NAV2 is selected:
Custom_Tooltips_NAV2.jpg


Do you remember I mentioned earlier that Tooltips don't like white spaces between lines? See what happens if I don't eliminate them (below, take a look at the code and the image):
HTML:
      <!-- Course Knob -->
          <Area Left="27" Top="538" Width="127" Height="127">
              <Tooltip>
                  %((L:SK407_HSI_NAV_Source,bool))
                  %{if}
                  CRS 2: %((A:NAV2 OBS,degrees))%!03.0f!
                  %{else}
                  CRS 1: %((A:NAV1 OBS,degrees))%!03.0f!
                  %{end}
              </Tooltip>
              <!-- CRS DEC-->
              <Area Right="60">
                  <Cursor Type="DownArrow"/>
                  <Click Repeat="Yes">
                      (L:SK407_HSI_NAV_Source,bool)
                              if{ (>K:VOR2_OBI_DEC) }
                          els{ (>K:VOR1_OBI_DEC) }
                  </Click>
              </Area>
              <!-- CRS INC-->
              <Area Left="66">
                  <Cursor Type="UpArrow"/>
                  <Click Repeat="Yes">
                      (L:SK407_HSI_NAV_Source,bool)
                              if{ (>K:VOR2_OBI_INC) }
                          els{ (>K:VOR1_OBI_INC) }
                  </Click>
              </Area>
          </Area>

Wrong result!
Custom_Tooltips_wrong.jpg


Either way, I hope you find this helpful.
Sergio.
;)
 
Last edited:
1) Unlike regular code evaluation, gauge strings require an "else" instead of "els".

2) Nested evaluations require an %{end} to work and it's good practice to add an %{end} even if only a single evaluation is performed. Example for nested evaluations:
Code:
Does this work? (%((L:var1,bool) (A:some variable,psi) 60 &gt; and)%{if}%((L:Var2,number) 2 &lt;=)%{if} Yes%{else} Maybe%{end}%{else} No%{end})

3) "%(...)" can also write to L or G vars and set event IDs, e.g.
Code:
%((A:Sim On Gound,bool) d (>L:Is plane on ground, bool) (>K:PANEL_LIGHTS_SET))

4) Variables taking numbers as values can be evaluated with %{case}, e.g.
Code:
%((L:My variable, number))%{case}%{:0}No%{:1}Yes%{:2}Definitely%{:4096}Now you're exaggerating%{end}

5) There's a hard limit for the number of characters the can be displayed per line (something around 128 or so), however, the associated code may be much longer.
 
Hello Bjoern

As always, thank you very much for your feedback. As I learned many things from you, this is really appreaciated. Certainly I will do more tests with
your observations in mind! :wizard::wizard::wizard:

%((L:My variable, number))%{case}%{:0}No%{:1}Yes%{:2}Definitely%{:4096}Now you're exaggerating%{end}
You made my day with this acid humor of yours, love it!

EDIT 1:
Also, thank you for the reminder that G:Vars are also in the spectrum... as I don't use them, I forgot about them! :duck::duck::duck:
The main thing I can remember, is that they are some sort of "Local Variables" and are used for a unique instance of the gauge (not sure about this).
For sure, I am not aware of the correct way to use this kind of variables and for this reason, I am probably missing their benefits.

Sergio.
;)
 
Last edited:
Sergio, I rarely use G:Vars in any of my gauge work, as they have a very limited utility. Unless you are looking up something from the fs9gps.dll that you don't want any other instance of the same gauge to see, I can't really think of any other utility. But then, I am an old man and slow to learn. :rotfl:
 
Good evening, dear Fr. Leaming!

As always, it makes me happy to recieve your advice and other useful concepts. That confirms my original theory! Thank you, dear Sr.

But then, I am an old man and slow to learn. :rotfl:
I wish I have 0.000000001% of your experience! The simple fact that you are so keen to learn something new every single day, makes me think you have a young, very prolific and untamed mind. This is a valuable lesson which I try to practice daily as well.

Affectionately,
Sergio.
:wave:
 
G type variables are indeed limited to the gauge they are used in. They're useful if you need a variable that won't need to show up in L: var viewers.
 
Back
Top