My 2 methods so far:
1. "Overwrite" method. The text widged has a label that appears as off-white or light grey in the dialog box. The label is static. By creating another text widget with the same coordinates, and making the second text widget "live", i.e. "<live>1</live>" and assigning the widget a color and a property, the color of the text in the dialog box can be manipulated in real time. For example, just write the green text over the off-white text, and for the pilot, the text appears to change color from off-white to green.
Example:
- Code: Select all
<text> # Note: this widget is not "live". Its label "Hello" is static.
<row>4</row>
<col> 2</col>
<label>Hello</label
</text>
<text> # Note: this widget is "live", and is updated in real time as the property changes.
<row>4</row>
<col>2</col>
<color>
<red>0</red>
<blue>0</blue>
<green>1</green>
</color>
<live>1</live>
<property>whatever/whatever/colored-label</property> #This property holds same text as static widget, the word "Hello".
</text>
The above method works for me, but I don't know whether or how the overwrite graphics would affect other users with different system capabilities.
I suspect this method may be "illegal" .
That's why I explored another option, which is method 2.
Method 2:
"Replace" method. Make both text widgets "live" and before writing the colored text to the location, remove the "default" text by setting its property to "".
- Code: Select all
<text> # This widget contains the default text stored in a property, and the widget is "live":
<row>4</row>
<col>2</col>
<live>1</live>
<property>whatever/whatever/not-colored-label</property>
</text>
<text> # This widget contains the same text label in its property, but colored green:
<row>4</row>
<col>2</col>
<color>
<red>0</red>
<blue>0</blue>
<green>1</green>
</color>
<live>1</live>
<property>whatever/whatever/colored-label</property>
</text>
################
The "dialogs" readme explains how to make a text widget and how to color the text, but not how to change the color of the text dynamically.
I'm looking for the best way to change GUI dialog text color dynamically, as properties change.
Specifically:
Is method #1, the "overwrite" method, legal?
Is there a better way to change gui text dynamically other than my 2 methods?
Or, if you don't know how to do it but you remember an aircraft that has a dialog in which text color changes dynamically, please let me know the aircraft so I can download it and study its GUI dialogs.
Any help appreciated, and thanks!
Simworld2020