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

Changing Colour in Text Strings

Messages
278
Country
ca-britishcolumbia
Hope everyone has settled into the New Year. I am currently debugging and generally cleaning up my Nav Radar. I have, hopefully, a quick question regarding Changing the background colour of a text string when it is activated.

I currently have an option menu that allows you to change symbols and such. The Main colour is blue, but like it to turn say green when that text string is selected. See attached picture. I am hoping it is a rather simple manouvre, i did some searching earlier and all i found was some, to me complex code.

Thanks for any suggestions.
Greg

An example of my menu string:
Code:
<Element Name="AirportSymbolCircleRunways">
<Visible>(L:MFDOptions,bool) (L:AirportSymbols,bool)</Visible>
    <Position X="525" Y="463" />
    <FormattedText X="150" Y="25" Length="20" Font="Arial Black" FontSize="18" Adjust="Center" VerticalAdjust="Center" Color="0xF0D0D0" BackgroundColor="#0174DF" LineWidth="1" Multiline="No" Bright="Yes">
    <String>CIRCLE RUNWAYS</String>
    </FormattedText>
 

Attachments

  • Screenshot.jpg
    Screenshot.jpg
    114.8 KB · Views: 433
Check in the SDK for Escape Codes. You might try one of these:

\{rev} Reverse background/foreground color for text

or

\{bck} Background color
 
An excerpt from a gauge

Code:
<!-- VOR -->
  <Element Name="VOR-Button">
    <Position X="21" Y="6"/>
      <Rectangle Width="16" Height="10" LineWidth="0.9" Color="GRAY" Luminous="Yes"
       FillColor="%((L:NavM_Elec_Power_Supply,Volt) 20 &gt; if{ '#544925' } els{ '#323243' }"/>
  </Element>

So maybe you can adapt your "BackgroundColor" by adapting this part:

FillColor="%((L:NavM_Elec_Power_Supply,Volt) 20 &gt; if{ '#544925' } els{ '#323243' }"
 
Written, tested and works in FS9

Code:
  <Element>
    <Position X="21" Y="6"/>
    <FormattedText X="150" Y="25" Length="20" Font="Arial Black" FontSize="18" 
       Adjust="Center" VerticalAdjust="Center" Color="0xF0D0D0" 
       BackgroundColor="%((A:LIGHT LANDING,bool) if{ 'blue' } els{ 'green' }" 
       LineWidth="1" Multiline="No" Bright="Yes">
    <String>
      CIRCLE RUNWAYS
    </String>
    </FormattedText>
  </Element>

(A:LIGHT LANDING,bool) replace this with your Variable.
And adapt blue and green to your needs.

Edi
 
Thanks to you both. I tried using Bill's Escape codes and no luck with using condinational strings. Not that it doesn't work just maybe i never had the sequance write. So wrapping up I ended up using this:

Code:
<Element Name="AircraftSymbolsATC">
  <Visible>(L:AircraftSymbols,bool)</Visible>
  <Position X="525" Y="575.00" />
   <Text X="150" Y="25" Length="20" Font="Arial Black" FontSize="18" Adjust="Center" VerticalAdjust="Center" Color="0xF0D0D0" BackgroundColor="#0174DF" LineWidth="1" Multiline="No" Bright="Yes">
  <String>ATC</String>
  </Text>
</Element>
<Element Name="AircraftSymbolATCActive">
  <Visible>(L:MFDOptions,bool) (L:AircraftSymbols,bool)</Visible>
  <Position X="0.00" Y="0.00" />
  <Element>
    <Visible>(L:AircraftSymbolDisplay,enum) 1 ==</Visible>
    <Position X="525" Y="575" />
    <FormattedText X="150" Y="25" Length="20" Font="Arial Black" FontSize="18" Adjust="Center" VerticalAdjust="Center" Color="0xF0D0D0" BackgroundColor="#40FF00" LineWidth="1" Multiline="No" Bright="Yes">
    <String>ATC</String>
    </FormattedText>
  </Element>
</Element>

It worked fine and layered properly, but seemed to be an awfull lot of coding to simply switch background colours. When awoke this morning Ed left me a source that worked well and shortened the amount of code I had to use. And this is the end result:

Code:
<Element Name="AirportSymbolCircle">
  <Visible>(L:MFDOptions,bool) (L:AirportSymbols,bool)</Visible>
  <Position X="525" Y="493" />
  <FormattedText X="150" Y="25" Length="20" Font="Arial Black" FontSize="18" 
   Adjust="Center" VerticalAdjust="Center" Color="0xF0D0D0" 
   BackgroundColor="%((L:AirportSymbolDisplay,enum) 2 == ) if{ '#40FF00' } els{ '#0174DF' }" 
   LineWidth="1" Multiline="No" Bright="Yes">
  <String>CIRCLE</String>
  </FormattedText>
</Element>

I have attached a couple of pictures showing the end result. Thanks again to you both for your solutions.

Greg
 

Attachments

  • Screenshot1.jpg
    Screenshot1.jpg
    109.4 KB · Views: 402
  • Screenshot2.jpg
    Screenshot2.jpg
    101.1 KB · Views: 469
  • Screenshot3.jpg
    Screenshot3.jpg
    99.3 KB · Views: 440
Greg,
this is a very interesting gauge!

Is this a "Real World" - instrument??
Is this a freeware project?

Edi
 
Thanks for the inquiry Ed...
To the first question is yes and no. I know of no gauge like this in real world, but in my experience resembles the layout of a Marine RADAR. The rest is things I liked about other gauges I came across and wanted everything in one. Unfortuantly I came across some of the bundles that I liked were payware guages to which the group I fly with some may not afford. So I set out to build this for my group as Freeware. It is definatly a work in progress and am planning to release the first functional version by the middle of the month to my group, give a couple weeks to clean up any missed bugs or issues and upload it to the general public and see where it goes. I still have the manual to create so that may take some time, but should be starting on that within the next couple days.

This does lead me to on of my next questions, as this gauge was created using a lot of the knowledge base within FSDeveloper. What is the best site to upload this program or what do most member's use from here?

Once again thanks everyone for making this happen.
Greg
 
btw.

Code:
<Visible>(L:MFDOptions,bool) (L:AirportSymbols,bool)</Visible>

(L:MFDOptions,bool) is too much.
Or you forget an operator.

Edi
 
Thanks to you both. Thanks Ed for pointing that out. Part of it is my lack of experience and part a victim of copy and paste.

Greg
 
Back
Top