-
March 13th, 2021, 21:38 #1
Setting a control's label programmatically
I'm using a "string_labeled" control, and I want to update the label programmatically. It normally has a child tag, "labelres", that specifies the string resource to use for the label, but I can't figure out how to programmatically specify a string or another string resource.
Thanks in advance.Playing tabletop RPGs since 1983.
GMing: West Marches (Numenera); Revenge on the Dragon (Cypher System); The Ultimate Cake Recipe (Invisible Sun)
FG Unity Ultimate License holder
https://wanderingmonster.org.
-
March 13th, 2021, 23:39 #2
Refer to the Developer Guide -> Ruleset API Reference in the Wiki.
The stringcontrol guide is here: https://fantasygroundsunity.atlassia.../stringcontrol It inherits the "textbasecontrol" which has setValue - https://fantasygroundsunity.atlassia...ntrol#setValuePrivate Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
March 14th, 2021, 00:32 #3---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
March 14th, 2021, 06:48 #4
I'm looking to set the label, not the value. The value appears above a horizontal line, and a label appears below it. Here's a snippet of the control:
<string_labeled name="guide_attr">
<anchored to="guide_skill" width="40" height="20">
<top />
<right anchor="left" offset="-5" />
</anchored>
<readonly /> <labelres>journey_party_roles_guide_attr_label</labelres>
<tooltip>journey_party_roles_guide_attr_tooltip</tooltip>
</string_labeled>
And what it looks like:
Screen Shot 2021-03-13 at 21.46.49.png
It's the "labelres" ("NAME" in the attached image) value that I want to change.Playing tabletop RPGs since 1983.
GMing: West Marches (Numenera); Revenge on the Dragon (Cypher System); The Ultimate Cake Recipe (Invisible Sun)
FG Unity Ultimate License holder
https://wanderingmonster.org.
-
March 14th, 2021, 08:17 #5
What is the use case?
In MoreCore I have a number of user-editable labels.
-
March 14th, 2021, 09:31 #6
A "string_labeled" control is a template based on the stringcontrol base control. To change the text in that control (the text of the label in this case) you need to change the value of the control with setValue
So what I and celestian mentioned above is accurate.
If you're running code within the window where the control is use guide_attr.setValue("my new text"); If you're running code within the label just use setValue("my new text") If you're running code somewhere else in the GUI you'll need to navigate the GUI hierarchy to reach the control.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
March 15th, 2021, 00:12 #7Playing tabletop RPGs since 1983.
GMing: West Marches (Numenera); Revenge on the Dragon (Cypher System); The Ultimate Cake Recipe (Invisible Sun)
FG Unity Ultimate License holder
https://wanderingmonster.org.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks