PDA

View Full Version : Label Controls



bloodylemming
December 30th, 2021, 15:25
Trying to dynamically control the text in a Label.
Is the Label object a Text Widget?

Moon Wizard
December 30th, 2021, 20:22
You should probably take a read over the Developer Guide to get a rough idea of all the pieces:
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644285/Developer+Guide

A label is actually a template, that ends up resolving to a stringcontrol object type.
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644511/Ruleset+-+Templates+for+code+re-use
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645166/stringcontrol

And you probably need to know about window/control relationships to make sure you're changing the right ones.
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644483/Ruleset+-+Interfaces+Windows+Panels+Widgets

But, your best bet is to read over the Dev Guide.

Regards,
JPG

damned
December 30th, 2021, 23:37
Hi bloodylemming,



function onValueChanged()
if getValue() < 9 then
window.Label1.setValue("Below Average");
elseif getValue() > 13 then
window.Label1.setValue("Above Average");
end
end

bloodylemming
December 31st, 2021, 01:43
Hi bloodylemming,



function onValueChanged()
if getValue() < 9 then
window.Label1.setValue("Below Average");
elseif getValue() > 13 then
window.Label1.setValue("Above Average");
end
end


This is the direction I was going, but I kept getting an error. Got it to work on some labels but not others. Created a new character and now it works fine. Weird....
Thanks. This is going to come in really handy. Wish you could center regular text fields.

damned
December 31st, 2021, 02:01
Add custom control property with property name of center
Dont use labels instead of text fields
just making things hard for yourself

bloodylemming
December 31st, 2021, 04:10
Add custom control property with property name of center
Dont use labels instead of text fields
just making things hard for yourself

I'm not finding information on how to do this. Have you done this in a video you can point me to?

damned
December 31st, 2021, 04:23
https://www.youtube.com/watch?v=gzl3tguwX_E

bloodylemming
December 31st, 2021, 19:15
https://www.youtube.com/watch?v=gzl3tguwX_E

Well, that explains it. I'm only on episode 10. !)

Thanks!