PDA

View Full Version : Concerning <windowclass>, <sheetdata>, and Templates



swest
October 13th, 2021, 22:56
Ok, 'nother noobie question.

Here is CoreRPG's character sheet main page windowclass (from record_char_main.xml and abridged slightly for readability, with some question markers):


<windowclass name="charsheet_main">
<margins control="0,0,0,2" />
<sheetdata> #1
<frame_char name="attributesframe">
<bounds>15,0,-29,-50</bounds>
</frame_char>
<label_frametop> #2
<anchored to="attributesframe" /> #3
<static textres="char_label_attributes" /> #4 and #5
</label_frametop>
<list_charmaincategory name="categories">
<anchored to="attributesframe">
<left offset="15" />
<top offset="35" />
<right offset="-20" />
<bottom offset="-20" />
</anchored>
</list_charmaincategory>
.
.
<string_labeled name="senses">
<anchored to="sensesframe" position="insidetop" offset="-15,10" height="20" />
<label>Senses</label> #6
<delaykeyupdate />
</string_labeled>
</sheetdata>
</windowclass>

And here is the "label_frametop" instance (reprinted from above) along with its template (from template_common.xml):



<label_frametop>
<anchored to="attributesframe" />
<static textres="char_label_attributes" />
</label_frametop>

---------

<template name="label_frametop">
<label>
<anchored position="insidetop" offset="0,10" />
<center />
</label>
</template>

Q #1: I have read the 'definition' of the sheetdata tag from both the Old, and New, Developer's Guides. I think I get it, although a more rigorous definition might be more illuminating. If there is any other place to go to get a better understanding please let me know (I know that's vague, but there's diminishing returns in trying to enumerate the other questions I have.)

Q #2: There is no 'name = "blah"' associated with this template instance. What is the significance of that for this case?

Q #3: I can only assume that the "<anchored>" tag in the windowclass instance overrides the anchored tag in the template. Is there some guidance on this?

Q #4: On the other hand, there is no "<static>" tag in the template, so what is the meaning of including something that doesn't appear in the template? (NOTE: I just re-read the Templates page from the Developer's Guide, and I probably have #3 and #4 figured out... If there is any additional nuance to add, please do.)

Q #5: And on the subject of the "<static>" tag, how does one know when a tag like this can just be put... well... anywhere? I can find no help in establishing a context for this usage.

Q #6: Finally, there seemed to be a rule in place (to ease the conversion to a different language) for defining strings and then referencing them with "textres=..." But here we just have 'Senses', which appears to contravene that rule. Is there something special about this instance?

Thanks!!!

- s.west

Trenloe
October 14th, 2021, 01:41
#1 - <sheetdata> contains the definitions of all the controls within the <windowclass>. Nothing more involved than that.

#2 - if there isn't a name for the control then it can't be referenced in scripts and it can't be overridden via merge functionality in an extension or layered ruleset.

#3 - information on templates here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644511/Ruleset+-+Templates+for+code+re-use See the "Merge Behavior" section in particular.

#4 - OK, you've already got this figured out. Should have read further before answering your questions. But also would have been nice to have edited/removed questions you've already sussed out yourself! :)

#5 - Refer to "static" in the stringcontrol definition here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645166/stringcontrol

#6 - This is purely a developer preference - they are hard coding "Senses" rather than using a string resource. Ideally code should use textres references to facilitate easier translation. But there's many places in code where this isn't done - for either ease/quickness of coding or to maintain a specific naming convention.

swest
October 19th, 2021, 21:53
Thanks!

I will certainly highlight, up front, any questions I have already figured out, but which I intentionally leave in, in case, as I mentioned, "If there is any additional nuance to add, please do."

- s.west