Thread: Relative control anchoring
-
November 3rd, 2018, 23:32 #1
- Join Date
- Oct 2018
- Posts
- 14
Relative control anchoring
I'm having a bit of a problem with relative control anchoring, I thought I understood how to use it - and in one quick test it worked fine. But now I'm having problems and I'm not sure where I'm going wrong -- or if the fact that I'm doing some layering/overriding of a window class from MoreCore, from an extension is causing problems.
So here's what I'm trying to do, and it works well enough with absolute positioning:
Absolute.png
And that's using this code:
Code:<?xml version="1.0" encoding="iso-8859-1"?> <root version="3.3" release="1"> <announcement text="Parameterized Rolls v.1 for MoreCore" font="emotefont" icon="rulesetlogo_CoreRPG" /> <properties> <name>Parameterized Rolls</name> <version>1</version> <author>MCortez</author> <description>Adds the ability to have a separate fields to provide parameters to rolls</description> <ruleset><name>MoreCore</name></ruleset> </properties> <base> <windowclass name="cli_rolls" merge="merge"> <sheetdata> <simplestring name="name"> <anchored position="insidetopleft" offset="0,0" height="18"> <right parent="rightanchor" anchor="left" relation="relative" offset="-81" /> </anchored> </simplestring> <number_standard name="param1"> <anchored to="name" position="right" width="9" offset="4,0" /> <default>0</default> </number_standard> <number_standard name="param2"> <anchored to="name" position="right" width="9" offset="24,0" /> <default>0</default> </number_standard> <number_standard name="param3"> <anchored to="name" position="right" width="9" offset="44,0" /> <default>0</default> </number_standard> <button_rolls_type name="rollstype"> <anchored to="name" position="right" width="18" offset="60,0" /> </button_rolls_type> </sheetdata> </windowclass> </base> </root>
Relative.png
And here's the the bits that I changed, which is basically just adding the relation parameter, and adjusting the offset parameter to be my desired spacing between controls:
Code:<number_standard name="param1"> <anchored to="name" position="right" width="9" offset="4,0" relation="relative" /> <default>0</default> </number_standard> <number_standard name="param2"> <anchored to="name" position="right" width="9" offset="4,0" relation="relative" /> <default>0</default> </number_standard> <number_standard name="param3"> <anchored to="name" position="right" width="9" offset="4,0" relation="relative" /> <default>0</default> </number_standard> <button_rolls_type name="rollstype"> <anchored to="name" position="right" width="18" offset="4,0" relation="relative" /> </button_rolls_type>
Have I been staring into my monitor too long, and I'm missing something simple?
Any suggestions would be greatly appreciated!
-
November 4th, 2018, 01:05 #2
The existing code uses:
Code:<button_rolls_type name="rollstype"> <anchored to="name" position="righthigh" width="18" offset="2" /> <script file="common/scripts/morecore_rolls.lua" /> </button_rolls_type>
-
November 4th, 2018, 01:21 #3
The anchor param is made of multiple parts. Your relation args look good, but I think you forgot about your anchor 'base'
In this case, you want the "left" part of the control anchored to be relatively "right" of the previous control where both controls are anchored to the same parent.
ie:
Code:<genericcontrol name="foobar"> <anchored width="10" height="10" /> <left parent="name" anchor="right" relation="relative" offset="5" /> <anchored/> </genericcontrol>
Code:<genericcontrol name="foobar" > <anchored to="name" width="10" height="10" /> <left anchor="right" relation="relative" offset="5" /> <anchored/> </genericcontrol>
-
November 4th, 2018, 01:57 #4
- Join Date
- Oct 2018
- Posts
- 14
Thank you both!
Ken L - it looks like you hit it on the head, apparently the relation="relative" attribute only seems to work (at least in this situation) if an explicit <left/> <right/> <top/> or <bottom/> tag is provided.
I would have thought that it would be able to get that from position="right" attribute - seeing as it worked exactly as expected if I left out the relative attribute. The left side of the new control was being anchored to the right side of the anchoring object, and the offsets were behaving as expected - but as soon as that relative attribute got added, things went wonky...
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks