Create account / Log in

Change Text Label Background after counter deployed

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Change Text Label Background after counter deployed

Postby Mjolnir06 » December 16th, 2020, 3:00 pm

Is there a way to change a "text labels" color or background color after it is deployed on to the map?

I am seeking a way to change this mid game.
Mjolnir06
 
Posts: 10
Joined: October 18th, 2020, 2:23 am

Re: Change Text Label Background after counter deployed

Postby JoelCFC25 » December 16th, 2020, 3:11 pm

I'm pretty skeptical that this is possible, as Text Label traits cannot have their color properties modified at run-time, nor do they have an ability to be deactivated by a keystroke (otherwise with a Trigger you could turn the initial one off and activate a second Text Label that is identical to the first except for background color).
JoelCFC25
 
Posts: 793
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Change Text Label Background after counter deployed

Postby marktb1961 » December 16th, 2020, 7:02 pm

Joel is on the right lines to suggest using a text label for each color.

You can effect activation / deactivation using a calculation forces a null text string into one of the text labels (turning that color off) whilst letting the text value be valid in the other label.

For example if TextColor is a property that you set to control the Text Label activation, the following expressions could be used in two different Text Labels to allow color switching:

{ TextColor==1 ? "This label displays when TextColor is set to 1" : "" }

and in the other Text Label, same field :-

{TextColor==1 ? "" : "This label displays when TextColor is not set to 1" }


Using padding in your label text (e.g. html width/text justification or   and line breaks) you can create the illusion of a fixed background label on which your text is displayed.

Examples of this technique are in the following prototypes in my experimental version of the C&C Napoleonics module, here:
Army Heading - Dynamic Text
and
Combat Assist (the two "Dice to Roll..." text labels and Calculated Property DiceToRoll)

Mark
Platform: Vassal 3.5.3, MacOS Big Sur on iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 445
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Change Text Label Background after counter deployed

Postby jrwatts » December 16th, 2020, 9:50 pm

I can confirm that Mark's suggestion works, as I came up with the same idea for the module I'm currently working on.
jrwatts
 
Posts: 224
Joined: April 29th, 2020, 10:30 pm


Return to Module Design

Who is online

Users browsing this forum: Cundiff and 3 guests