PDA

View Full Version : Having trouble with expected behavior of relation="current"



Varsuuk
November 12th, 2024, 02:37
The result of my attempts to stack a control on top of another (I will be adding code that only enables one of them based on character's class) before continuing on to add more controls did not work as planned. Instead both controls appeared side by side:

Basic template:


<template name="d6actioncheck">
<basicnumber>
<frame name="groupbox" offset="7,5,7,5" />
<rollable />
<hideonvalue value="0" />
<anchored to="columnanchor" height="30" width="45">
<top anchor="bottom" />
<left anchor="right" relation="relative" />
</anchored>
...

TECHNICALLY, the "left" line is: <left anchor="right" postoffset="10" relation="relative" /> but I removed the "postoffset" while troublshooting.

Template in use, places things in right place but I expected turnundead to cover singforsupprt:
Things look good except that the

Anchors definitions:


<template name="anchor_row">
<genericcontrol>
<anchored to="contentanchor" position="insidetop" height="0">
<top anchor="bottom" />
<left anchor="right" />
</anchored>
<disabled />
<invisible />
</genericcontrol>
</template>

...
<sheetdata>
<anchor_content_top name="contentanchor" />
<anchor_row name="columnanchor" />

<!-- First row of Lore/action buttons -->
...
<!-- Second row of Lore/action buttons -->
<anchor_row name="columnanchor2">
<anchored>
<top anchor="bottom" offset="48" />
</anchored>
</anchor_row>

<d6actioncheck name="surprisedon">
<anchored to="columnanchor2" />
<rollable mergerule="delete" />
<targetgenerator>lorecheck</targetgenerator>
<description textres="char_surprisedon_tooltip" />
</d6actioncheck>
<label_fieldtopverticalinset>
<anchored to="surprisedon"/>
<static textres="char_label_surprisedon" />
<tooltip textres="char_surprisedon_tooltip" />
</label_fieldtopverticalinset>

<d6actioncheck name="singforsupper">
<anchored to="columnanchor2" />
<targetgenerator>secretdoorcheck</targetgenerator>
<description textres="char_singforsupper_tooltip" />
</d6actioncheck>
<label_fieldtopverticalinset>
<anchored to="singforsupper" />
<static textres="char_label_singforsupper" />
<tooltip textres="char_singforsupper_tooltip" />
</label_fieldtopverticalinset>
<anchored to="columnanchor" height="30" width="45">
<top anchor="bottom" />
<left anchor="right" postoffset="10" relation="relative" />
</anchored>

<d6actioncheck name="turnundead">
<anchored to="columnanchor2">
<left anchor="right" relation="current" offset="0"/>
</anchored>
<targetgenerator>secretdoorcheck</targetgenerator>
<description textres="char_turnundead_tooltip" />
</d6actioncheck>
<label_fieldtopverticalinset>
<anchored to="turnundead" />
<static textres="char_label_turnundead" />
<tooltip textres="char_turnundead_tooltip" />
</label_fieldtopverticalinset>

Trenloe
November 12th, 2024, 03:04
Template in use, places things in right place but I expected turnundead to cover singforsupprt:
Things look good except that the
I don't know what this is describing. Can you expand on what the issue is - maybe show some screenshots.

Also make sure that the XML is correct - you have an <anchored> definition between <label_fieldtopverticalinset> and <d6actioncheck name="turnundead">

Varsuuk
November 12th, 2024, 06:35
Thanks Trenloe :) I was trying to do 2 things - cleanup my use of anchors to be "Best practices" I ended up where I did after much trial and error and tossing at the wall to see what stuck (ie: gave output I wanted even if the code was terrible)

The second was I wanted to know how to handle putting multiple controls in same spot and only making one "visibile" when needed - that I suspected used relation="current" but I didnt do something right until restarted (vs reloaded) ruleset. But was moot anyway, didn't need the "current" option just the invisible flagging.

The "anchored" thing between those controls was a cut and paste error.


I did get it working a bit back.
I don't think you will be interested in the detail but I received tips from Dominic and I went in and applied them keeping track of my steps so if I got no where I could ask him for advice.
Turns out that was enough, what he told me about using the single anchor - from there I figured out to using absolute and explicitly moving myself to the left edge on "carriage return" when I wanted to start a new line then change who the "relative" anchor was.


Next step tomorrow is looking for and if not, posting to see if anyone has general pointer on how to move an "action" from regular roll to auto-dicetowering. I tried one thing as a hail mary but no love. Will check tomorrow with fresh eyes since spent to much energy on the other thing :)

The tower thing isn't important (one can simply drag) but I wanted to make a control always roll in the tower cos it made sense. But again, tomorrow.

Here is link from where uploaded it in discord: https://cdn.discordapp.com/attachments/389093811021807616/1305760960975470632/ThankYouDominic.pdf?ex=67343428&is=6732e2a8&hm=04ad9659df6e736240fa8114deffca68fe2cd17e7dfdd82 d2164c3a3c5832d54&

Again - don't need to look at this, it was just my tracing the fix for the questions I had on anchoring.


I AM TERRIBLE at UI placements/XML ;) It's "standard" coding I like to do. Stuff like figuring out rolls etc don't frustrate me unlike xml templates and UI work hehe.