PDA

View Full Version : Example of "expanding" label



Varsuuk
June 23rd, 2023, 05:20
I've been using "label_fieldtop", I was wondering - is there a better way than setting a "width" element in <anchored> to make it fit longer strings? Like is there a current control that either via some API or in script takes the textres and centers it above some control?
I suspect this is a newbie question, but asking anyway :) (cos my way is clunky if the string resourse is changed)

Moon Wizard
June 23rd, 2023, 06:19
It all depends on how large you want the label to be.

Since string controls must have a horizontal anchor; you have to specify either a left anchor, a right anchor, or both. label_fieldtop uses "above" which sets the bottom, left and right anchors along with offsets (1 pixel above, and 3 pixels expanded on each side). You can potentially specify a larger horizontal expansion by specifying an "<anchored offset="5,1" />" in your control (or something similar).

When I find these situations, I usually shorten the label and add a hover tooltip with more information, so that the sheet doesn't become more cluttered.

Regards,
JPG

Varsuuk
June 23rd, 2023, 16:51
Thanks :)

Yup, that's what I was doing - changing the offset per control if needed it.
Yeah, I was TRYING to use the shorted label I could. But it is a "Temporary Hitpoints" and "Non-lethal Damage" numberbox. So I tried "TmpHP" and "TmpDmg" I had to expand both manually to make it work. I'd have preferred a thing that autoexpands so if I change the text in resources I didn't forget to also re-tweak the label window. Or if someone ELSE does it to internationalize it to another language they would have to know to edit the controls too. The good news is I highly doubt anyone else will be using it and needing that but still - I think of corners.

I ended up making them a good deal bigger and squoze in "Tmp HP" and "Tmp DMG" with an exact fix (and slight space either side) via trial and error size tests.

Moon Wizard
June 23rd, 2023, 19:28
THP and TDMG; plus tooltips?

Regards,
JPG

Varsuuk
June 23rd, 2023, 21:48
I already had the detailed tooltips it DAMMIT MAN, Thep ;) and tdmg work for me. Obviously, brevity and clarity are neither my advantages or feats to borrow from Savage Worlds and D&D ;)