Header Script: Difference between revisions
New page: {{context|Kit Reference|Script Types}} ==Technical Details== :{| class="scripttable" |class="leftnormal"|Initial Context: |Template |- |Alternate Context: |None |- |... |
No edit summary |
||
Line 25: | Line 25: | ||
==Description== | ==Description== | ||
The | The Header script behaves very similarly to the [[Position Script|Position script]]. This script's purpose is to handle the sizing and positioning of visual elements in one specific situation. When the same template is used within a table for positioning both items '''and''' a header, the Header script serves to position the header portals. If two separate templates are used for items versus header, the Position script for each is used and the Header script is not employed. | ||
Although the behaviors are similar, the Header script is distinct from the Position script in a variety of ways. First of all, portals within the template that are designated as "isheader" are only accessible via the Header script, hence the name. Second, the Header script is invoked '''after''' the normal Position script. This allows the header contents to be sized and positioned relative to the final locations for non-header portals. To make this easy, the Header script '''can''' access '''both''' header and non-header portals, although any positioning changes to non-header portals is ignored. | |||
For more details, please see the section on [[[[Dual-purpose Headers on Tables|dual-purpose headers]]. | |||
==Example== | ==Example== | ||
We'll assume that there are two fields within each item of the table that we want to put a simple header above. Let's call them "damage" and "range", and each is shown within its own portal. These two portals are positioned via the Position script, so the Header script will position the header labels directly above those portals. | |||
<pre> | <pre> | ||
~ | ~our header height is the height of our labels | ||
height = portal[hdrdamage].height | |||
~if this is a "sizing" calculation, we're done | |||
if (issizing <> 0) then | |||
done | |||
endif | |||
~each of our header labels has the same width as the corresponding data beneath | |||
portal[hdrdamage].width = portal[damage].width | |||
portal[hdrrange].width = portal[range].width | |||
~ | ~center each header label on the corresponding data beneath | ||
portal[ | perform portal[hdrdamage].centeron[horz,damage] | ||
perform portal[hdrrange].centeron[horz,range] | |||
~ | ~align all header labels at the bottom of the header region | ||
portal[ | perform portal[hdrdamage].alignedge[bottom,0] | ||
perform portal[ | perform portal[hdrrange].alignedge[bottom,0] | ||
</pre> | </pre> |
Revision as of 09:52, 12 December 2008
Context: HL Kit … Kit Reference … Script Types
Technical Details
Initial Context: Template Alternate Context: None Fields Finalized? Yes
The Header script utilizes the following special symbols:
-None- There are no special symbols for a Header script
Description
The Header script behaves very similarly to the Position script. This script's purpose is to handle the sizing and positioning of visual elements in one specific situation. When the same template is used within a table for positioning both items and a header, the Header script serves to position the header portals. If two separate templates are used for items versus header, the Position script for each is used and the Header script is not employed.
Although the behaviors are similar, the Header script is distinct from the Position script in a variety of ways. First of all, portals within the template that are designated as "isheader" are only accessible via the Header script, hence the name. Second, the Header script is invoked after the normal Position script. This allows the header contents to be sized and positioned relative to the final locations for non-header portals. To make this easy, the Header script can access both header and non-header portals, although any positioning changes to non-header portals is ignored.
For more details, please see the section on [[dual-purpose headers.
Example
We'll assume that there are two fields within each item of the table that we want to put a simple header above. Let's call them "damage" and "range", and each is shown within its own portal. These two portals are positioned via the Position script, so the Header script will position the header labels directly above those portals.
~our header height is the height of our labels height = portal[hdrdamage].height ~if this is a "sizing" calculation, we're done if (issizing <> 0) then done endif ~each of our header labels has the same width as the corresponding data beneath portal[hdrdamage].width = portal[damage].width portal[hdrrange].width = portal[range].width ~center each header label on the corresponding data beneath perform portal[hdrdamage].centeron[horz,damage] perform portal[hdrrange].centeron[horz,range] ~align all header labels at the bottom of the header region perform portal[hdrdamage].alignedge[bottom,0] perform portal[hdrrange].alignedge[bottom,0]