PDA

View Full Version : Tips on how to resolve Tracker issue



celestian
February 26th, 2017, 02:38
I am using the 5e ruleset, hacking to add support for AD&D. To that end I've added "saves" to the CT (host) since AD&D doesn't use ability scores as saves (they are used for checks).

Anyway, I added them to the attributes button in the CT. To do that I had to make the section taller (it forced you to have the CT window wider than I thought useful). So, here is what it looks like.

Without it clicked.
https://i.imgur.com/FHWCw7V.png

With it clicked.
https://i.imgur.com/NMKmuF7.png

Looks great.... until you press any other toggle that is BELOW attributes at the same time you have the attributes toggled on.

(without, on combat)
https://i.imgur.com/PDd90Bt.png

(Attributes+Combat)
https://i.imgur.com/QVrz2EQ.png

It does the same if Attributes+Space is toggled.

So, I've been poking around trying to figure out what I am doing wrong. The method I used to make the block taller was this (from ct_host.xml)




<frame_ctsub name="frame_attributes">
<anchored>
<!-- <top parent="attributesicon" offset="-1"/>
<bottom parent="spacer_attribute" offset="30" />
-->
<top parent="attributesicon" offset="-1"/>
<bottom parent="save_paralyzation_poison_death_label" offset="10" />
</anchored>

</frame_ctsub>



The commented xml is what it had before.

I've been pouring over the section for combat (sword) since it has a variable height but I can't seem to tell what the difference is that keeps it from having the same issues.

Any thoughts?

Trenloe
February 26th, 2017, 03:22
You're not inserting your control to make proper use of the spacer_attribute generic control, which is being a "spacer" at the bottom of the attribute section. It uses "relative" anchoring, which is very important for these dynamic controls. See the section on "Anchoring" here: https://www.fantasygrounds.com/modguide/windowing.xcp Specifically the use if the relation="relative" tag as this is vital in keeping the spacing.

For the standard 5E "frame_attributes" frame_ctstub the spacer use relative anchoring to the "name" control. Within the attributes set of controls the number_ct_ability "strength" control also uses relative anchoring to "name". So, the spacer is shifted down to below the line where the "strength" is. Then other sections anchor below the spacer.

You can see this in your screenshot - the combat section appears right below the strength control (with a little room for the spacer).

If you use the same relative anchoring to "name" for your Poison control then this should automatically shift the spacer down and so the next section will follow after the spacer at the correct point. This is what is great about relative anchoring - you can add/remove sections of code and the following anchors adjust based off the "relative" controls.

The code you need to look at is:

<number_ct_ability name="strength" source="abilities.strength.score">
<anchored >
<top parent="name" anchor="bottom" relation="relative" offset="10" />
<left parent="attributesicon" anchor="right" offset="40" />
</anchored>
<target>strength</target>
</number_ct_ability>

celestian
February 26th, 2017, 03:43
Okay, that is nice. I have been using anchors to static points. I'll go review that section. I am horrible at layout, spend WAY to much time on it ;)

With the tips you gave me I was able to correct the viewing issue.

https://i.imgur.com/uRyamM8.png

Thanks!

Bidmaron
February 26th, 2017, 12:51
celestial, would you mind pasting in the relevant code you wound up using. Like you, I find the anchoring to be the most unfun and time-wasting aspect of coding for FG. I'd sure appreciate it.