Position Script: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{context|Kit Reference|Script Types}}
{{context|Kit Reference|Script Types}}
==Description==
The location of visual elements on the display is controlled via a number of different scripts. The location of templates is controlled via the Position script. Since templates are displayed within layouts that contain multiple visual elements, the actual position and dimensions of a template are usually controlled by its container. However, within the Position script, the location and dimensions of the portals within the template are also controlled. These portals are always positioned relative to the upper left corner of the template itself, so keep this in mind when performing any calculations.
{{note}}The Position script is read-only with respect to the contents of the portfolio, although visual elements may be modified. Within this script, all aspects of the hierarchy can be accessed, but nothing can be changed.
==Technical Details==


:{| class="scripttable"
:{| class="scripttable"
|class="leftnormal"|Initial Context:
|class="leftnormal"|Initial Context:
|Scene ([[Scene Context Transitions|context transitions]], [[Scene Target References|target references]]) or<br>
|[[Scene Context|Scene]] or [[Layout Context|Layout]] or [[Template Context|Template]]
Layout ([[Layout Context Transitions|context transitions]], [[Layout Target References|target references]]) or<br>
Template ([[Template Context Transitions|context transitions]], [[Template Target References|target references]])<br>
|-
|-
|Alternate Context:
|Alternate Context:
|None
|None
|-
|-
|Fields Finalized:
|Fields Finalized?
|Yes
|Yes
|-
|-
|}
|}


Initial Context: scene, layout, or template
==Special Symbols==
 
:{| class="infotable"
|class="leftnormal"|-None-
|There are no special symbols for a Position script
|-
|}
 
==Example==
 
For an example, we'll assume that we have a template that contains two portals: a label portal and a edit portal. The label portal is simply a literal string that is used to indicate the contents of the edit portal. The edit portal allows the user to modify the contents of a field within the pick, just like the hero's name is presented atop the display when using the d20 System data files. We assume that the location of the template itself is controlled by its container, with the template controlling its width and its contents. The Position script for a simple template like this might look like below:


description
<pre>
initial context
portal[stLblName].width = portal[stLblName].textwidth
alternate context (if any)
portal[stEdtName].left = portal[stLblName].right + 15
are field values finalized?
portal[stEdtName].height = portal[stEdtName].fontheight + 2
special symbols
width = portal[stEdtName].right
example
</pre>

Revision as of 00:12, 8 December 2008

Context: HL Kit &#133; Kit Reference &#133; Script Types 

Description

The location of visual elements on the display is controlled via a number of different scripts. The location of templates is controlled via the Position script. Since templates are displayed within layouts that contain multiple visual elements, the actual position and dimensions of a template are usually controlled by its container. However, within the Position script, the location and dimensions of the portals within the template are also controlled. These portals are always positioned relative to the upper left corner of the template itself, so keep this in mind when performing any calculations.

NOTE! The Position script is read-only with respect to the contents of the portfolio, although visual elements may be modified. Within this script, all aspects of the hierarchy can be accessed, but nothing can be changed.

Technical Details

Initial Context: Scene or Layout or Template
Alternate Context: None
Fields Finalized? Yes

Special Symbols

-None- There are no special symbols for a Position script

Example

For an example, we'll assume that we have a template that contains two portals: a label portal and a edit portal. The label portal is simply a literal string that is used to indicate the contents of the edit portal. The edit portal allows the user to modify the contents of a field within the pick, just like the hero's name is presented atop the display when using the d20 System data files. We assume that the location of the template itself is controlled by its container, with the template controlling its width and its contents. The Position script for a simple template like this might look like below:

portal[stLblName].width = portal[stLblName].textwidth
portal[stEdtName].left = portal[stLblName].right + 15
portal[stEdtName].height = portal[stEdtName].fontheight + 2
width = portal[stEdtName].right