PDA

View Full Version : Developer Guide questions (possible errata)



Varsuuk
March 19th, 2018, 13:59
Hey guys, reading the various guides, I came across this which I am guessing might be incorrect or if not, then I just need explanation so I can understand it better:

“Developer Guide - Rulesets - Interface
...
The following example creates a control whose left edge is 15 pixels from the left edge of the window, and right edge 15 pixels from the right edge of the window. The width would be equal to the window width minus 30 pixels. The top edge would be 40 pixels from the bottom of the window. The height of the control would be 25 pixels, due to the fact that the bottom edge would be calculated to be 15 pixels from the bottom of the window.
<bounds>15,-40,-15,20</bounds>“

I would think the height is simply 20 as indicated. The top is 40 pixels from the bottom of the window but it still extends the indicated 20 pixels so there is no adjustment needed to calculate unlike in the X plane.

?

Varsuuk
March 19th, 2018, 14:13
Further down...

The following two definitions places the control to the right of a control called "label", with the top of the control being 5 pixels from the top of the window. The size of the control is 30 pixels by 22 pixels.


<anchored>
<left>
<parent>label</parent>
<anchor>right</anchor>
</left>
<top>
<anchor>top</anchor>
<offset>5</offset>
</top>
<size>
<width>30</width>
<height>22</height>
</size>
</anchored>

<anchored width="30" height="22">
<left parent="label" anchor="right" />
<top offset="5" />
</anchored>


...

If they are meant to be equivalent, then I think the top one should be:

<top anchor=“top” offset="5" />

?

Varsuuk
March 19th, 2018, 14:35
In the following description, I did not get the last sentence:


Some typical anchoring schemes can also be set up using a shorthand notation. To use the shorthand notation, three tags are placed under the <anchored> tag.
"to" tag or attribute = Indicates the name of the control to anchor to
"position" tag or attribute = Defines the position relative to the parent control (see above)
"offset" tag or attribute = Contains two integer numbers, separated by a comma. These define the horizontal and vertical offset, respectively, applied to the positioning. These numbers are treated such that they increase the distance between the two controls, so the actual direction varies by position. For positions that share an entire edge, a positive offset will make the anchored control larger than the anchor target.


Not sure what that line means. In the later example, the offset on X is 5 and width is 34. If the Y had been equal in size and we were anchored to right, I don’t see what is meant by this meaning it is larger - the width is explicitly listed it is either larger, smaller or equal simply based on its width value, right?

Varsuuk
March 19th, 2018, 14:38
Finally for the nonce - any better explanation or example of use for the chart supplied and those values like “insideright” etc? I’m unclear.

The example using <to> etc that was a shorthand for the initial way of entering and not something specific to the <relative> and/or chart related way right?

Moon Wizard
March 19th, 2018, 17:40
Here you go:

1) This is an error, I'll replace 20 with -15, as it was supposed to be written.

2) If an anchor attribute/tag is not specified, then the same anchor is used as the one being defined. "If this tag is omitted, the matching edge will be used (i.e. left anchors to left edge of parent)"

3) Adjusted wording a bit, but still complicated concept. It almost needs another example. I'll add to my list.

4) Clarified the "to" attribute slightly to specify that it is used as the parent attribute for all specific anchors.

Regards,
JPG

Varsuuk
March 19th, 2018, 23:02
Moon!

Thank you for the quick clarifications. So far the wiki has been very informative and clear, these were the first going down from the page top (breadth-wise traversal) where I was significantly confused.

1. Great.
2.I get it, element name is default anchor (I’ll always be explicitly because I like the self-documentation but doesn’t nag what you did allowed for better brevity.)

The last 2 will need to wait until done with work and heading home to read.

I nearly understood the chart last night until I realized I didn’t heheh...

Thanks much again.

Varsuuk
March 20th, 2018, 13:58
ok, question 4 became clear and all examples in that section, I get now except: the bold one above I mentioned in post#3.

i am completely unsure what the labels/arrows indicate on the multi-called square diagram on that page. Not sure how the offset can make something bigger that what it offsets from, since size is a function of width or height and if the other is not mentioned it matches the anchor.

BUT... I am merely reading, not doing atm. So I will put a pin in it and see if becomes clear when take a window and plug in some values to see how reacts when supply things like “insideright” etc ;)


Great work indeed so far, I have more clarity than the first time I looked at the docs a long time back.

Moon Wizard
March 20th, 2018, 17:29
All of the position/to/offset attributes for the anchored tag can be translated into specific anchor tags, so an example may help.

So anchoring to the right edge of another control, would look like this:



<anchored to="hp" position="right" offset="5,2" width="30" />


and is equivalent to:



<anchored width="30">
<left parent="hp" anchor="right" offset="5" />
<top parent="hp" anchor="top" offset="-2" />
<bottom parent="hp" anchor="bottom" offset="2" />
</anchored>


Regards,
JPG

Varsuuk
March 20th, 2018, 21:51
Yup, your prior explanation led me to understand what you meant although your example above is definitely useful and I’d suggest adding it to the wiki for sure. All such examples are worth triple their worth in words ;)

One thing I noticed on the last part of that page.


The following creates a panel attached to the bottom of the desktop, being offset from the bottom by 15 pixels and having a height of 20 pixels. It spans the width of the desktop from the left edge to the left edge another panel called "shortcuts". It is only active when running as a session host.


<panel name="identitylist" modes="host">
<class>identitylist</class>
<anchored>
<bottom>
<anchor>bottom</anchor>
<offset>-35</offset>
</bottom>
<right>
<parent>shortcuts</parent>
<anchor>left</anchor>
</right>
<left>
<anchor>left</anchor>
</left>
<size>
<height>20</height>
</size>
</anchored>
</panel>
<panel name="identitylist" modes="host">
<class>identitylist</class>
<anchored>
<bottom anchor="bottom" offset="-35" />
<right parent="shortcuts" anchor="left" />
<left anchor="left" />
<size height="20" />
</anchored>
</panel>


Was bottom intended to be describing that the top of the panel is 35 pixels from the bottom of the desktop and is 20pixels in height. that would result in the bottom of the panel being 15px above bottom of desktop.

Or was it supposed to be that it should be bottom offset of -15 which along with height of 20 implies top of offset -35 without needing to explicitly list it?