PDA

View Full Version : Question on dynamic resizing on the core CT



Brenn
June 6th, 2015, 15:58
I've been banging my head against this for about four hours now and I can't figure out how this is being pulled off. So I thought I'd ask.

Ok, so in the core CT when you toggle the effects of a particular entry on/off or add/remove an effect the entry resizes and the list moves to accomodate. I want to add a feature like this on the character sheet I'm doing at the moment.
I've poured over the code in core and the answer is eluding me.

How in the heck is this happening?

I don't need a long huge explanation, just to get pointed in the right direction or just a general overview.

damned
June 6th, 2015, 16:09
Look at the Notes tab on 5e Char Sheet?
Or Actions when you click on a magnifying glass.

Trenloe
June 6th, 2015, 16:09
The controls use relative anchoring. See the "Anchoring" section here: https://www.fantasygrounds.com/modguide/windowing.xcp specifically the "relative" option. The controls that appear/disappear when the relevant buttons are pressed are all anchored on the same control: <string_ctname name="name"> with the top anchor of these controls all being "relative" to this "name" control. For example:


<anchored>
<top parent="name" anchor="bottom" relation="relative" offset="10" />

The relative relation means that the control will be anchored on the last control anchored to the "name" control - this links all of the visible controls with a relative relation to the same parent control together. If you set a control to be invisible (visible = false) then it will be removed from the relative relation anchoring and the following controls will be anchored on the control before the one removed.

It's a very powerful way of dynamically altering GUI layout as controls are added/removed (made visible/invisible).

Brenn
June 6th, 2015, 16:12
Wow. Ok, thanks! I think I understand. Sweet.

-
Edit:
Yeah that did it. Wow that makes things easy.