PDA

View Full Version : My Bane - Merging and Anchoring (Please help with inserting a control)



Minty23185Fresh
February 16th, 2021, 17:59
After every project I pat myself on the back and say, "Finally I have this anchoring and template merging down pat!" Then a year goes by and I try to do something slightly different and my nemeses come back in spades!

I love screenshots, so here there are:
First, in this one there are two panels, a view of the default behavior of the CoreRPG Encounter dialog on the left, and on the right, a view of the desired behavior: an additional control has been added, as shown in the red box.
43781

I have been testing feasibility by hacking the CoreRPG ruleset to get the desired view. Now it is time to extract the functionality into an extension with the least possible footprint of duplicate script. I have a working extension but only by duplicating the entire <windowclass> that houses my added control. I need to eliminate most of that duplicate xml script.

And in this screenshot some details (for those unfamiliar with the makeup of the Encounter dialog in the CoreRPG): The dialog is essentially a list of encounter items, each made up of a handful of controls. The "token" and "count" controls are anchored to a "left anchor". And the "link", "faction" and "id'ed" controls are anchored to a "right anchor". The "name" field in the middle is anchored on its left side to the "left anchor" and on its right side to the "right anchor". Anchoring in this manor causes the name control to shorten and lengthen as the user horizontally resizes the dialog. Following the existing pattern my control is anchored on it's right side to the right anchor.
43783

I started eliminating code with various attempts at changing the anchoring of the various controls anchored to the right anchor, with little success (typically at the cost of the name field's height property).

It seems to me, that this scenario, inserting an additional control in between a bunch of ruleset controls, has to have been repeated hundreds of times given the multitude of community developers out there. As such, it also seems to me, that there must be a simple "merge" and/or "mergerule" combination that will give me the desired outcome. But after trying a barrage of combinations I have yet to ascertain what the secret combo is.

Any help would be greatly appreciated

Moon Wizard
February 16th, 2021, 18:09
I would start with something like this:



<windowclass name="battle_npc" merge="join">
<sheetdata>
<button_record_eye name="eye" insertbefore="name" />
</sheetdata>
</windowclass>


Regards,
JPG

Minty23185Fresh
February 16th, 2021, 18:36
Aargh! Moon Wizard, thank you, “insertbefore” is so blatant. I knew the obvious was right under my nose.

Follow up. I’ve used merge=“join” before, a few times now. It is not in the Developers Guide documentation pages. (Advanced Merging). Is it the same as merge=“merge”?

Moon Wizard
February 16th, 2021, 18:46
Yes, they are equivalent.

JPG