Portal Context: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 58: Line 58:
|(Left, Right, Number) Controls whether the portal is displayed in a "frozen" state, where a frozen portal is non-editable and for display only. A non-zero value indicates the portal is frozen and a zero value indicates normal behavior.<br>
|(Left, Right, Number) Controls whether the portal is displayed in a "frozen" state, where a frozen portal is non-editable and for display only. A non-zero value indicates the portal is frozen and a zero value indicates normal behavior.<br>
Example: result = this.freeze<br>
Example: result = this.freeze<br>
Example: this.freeze = 1
Example: this.freeze = 1<br>
{{note}}All portals must be frozen '''before''' any portals are positioned.
|-
|-
|scrollbar
|scrollbar
|(Right, Number) Returns the width of a scroller, in pixels.<br>
|(Right, Number) Returns the width of a scroller, in pixels.<br>
Example: result = this.scrollbar
Example: result = this.scrollbar
|-
|sizetofit[''min'']
|(Right, Number) Reduces the font size, as necessary, to fit the text contents of the portal into the available space given by the portal dimensions. The font size will be reduced in quarter-point increments until either the text fits or the minimum font size given by ''min'' is reached. The value zero is always returned.<br>
Example: result = this.sizetofit[36]<br>
{{note}}This target reference is only valid for use with the various types of label portals.<br>
{{note}}The minimum font size allowed is 6-point for screen output and 4-point for printed output.
|-
|-
|autotop
|autotop
Line 103: Line 110:
Example: perform this.autoplace[42]<br>
Example: perform this.autoplace[42]<br>
Example: perform this.autoplace
Example: perform this.autoplace
|-
|batchadd[''gap'']
|(Right, Number) Queues the portal for batch placement within the containing layout, subject to the standard rules for [[Using Batch Placement|batch placement]]. As with "autoplace", the ''gap'' parameter specifies the gap to be used between this portal and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Batch placement for portals can only be used within layouts. A value of zero is always returned.<br>
Example: perform this.batchadd[42]<br>
Example: perform this.batchadd
|-
|-
|}
|}

Latest revision as of 05:44, 20 December 2013

Context: HL Kit &#133; Kit Reference  &#133; Multiple Sources

Jump to: Target References

The "portal" context identifies a portal within the current hierarchy. Portals can either be used within templates or within layouts, so the parent context of the portal within the hierarchy can vary.

Context Transitions

From within a "portal" context, you can utilize the following set of valid context transitions:

parent Transitions to the layout context or template context corresponding to the visual element that contains the portal.

Example: this.parent
NOTE! The "parent" transition can only be utilized a single time, so it is not possible to go upwards two or more levels within the hierarchy.

Target References

The "portal" script context governs the operations that can be applied to portals within templates and layouts. The complete list of target references for portals is presented in the table below.

width (Left, Right, Number) Accesses the width of the portal. Unless explicitly specified within the XML, the width of a portal is automatically initialized appropriately to the nature of the portal. Setting the width of a table portal triggers immediate re-sizing of all items within the table.

Example: result = this.width
Example: this.width = 42

height (Left, Right, Number) Accesses the height of the portal. Unless explicitly specified within the XML, the height of a portal is automatically initialized appropriately to the nature of the portal. Setting the height of a table portal triggers immediate re-sizing of all items within the table.

Example: result = this.height
Example: this.height = 42

left (Left, Right, Number) Accesses the position of the left edge of the portal within the containing visual element.

Example: result = this.left
Example: this.left = 42

top (Left, Right, Number) Accesses the position of the top edge of the portal within the containing visual element.

Example: result = this.top
Example: this.top = 42

right (Right, Number) Returns the position of the right edge of the portal within the containing visual element.

Example: result = this.right

bottom (Right, Number) Returns the position of the bottom edge of the portal within the containing visual element.

Example: result = this.bottom

visible (Left, Right, Number) Controls the visibility of the portal within the containing visual element. A non-zero value indicates the portal is visible and a zero value indicates hidden.

Example: result = this.visible
Example: this.visible = 1

freeze (Left, Right, Number) Controls whether the portal is displayed in a "frozen" state, where a frozen portal is non-editable and for display only. A non-zero value indicates the portal is frozen and a zero value indicates normal behavior.

Example: result = this.freeze
Example: this.freeze = 1
NOTE! All portals must be frozen before any portals are positioned.

scrollbar (Right, Number) Returns the width of a scroller, in pixels.

Example: result = this.scrollbar

sizetofit[min] (Right, Number) Reduces the font size, as necessary, to fit the text contents of the portal into the available space given by the portal dimensions. The font size will be reduced in quarter-point increments until either the text fits or the minimum font size given by min is reached. The value zero is always returned.

Example: result = this.sizetofit[36]
NOTE! This target reference is only valid for use with the various types of label portals.
NOTE! The minimum font size allowed is 6-point for screen output and 4-point for printed output.

autotop (Left, Right, Number) Accesses the position of the top edge of the auto-place region within the containing visual element.

Example: result = this.autotop
Example: this.autotop = 42

autobottom (Left, Right, Number) Accesses the position of the bottom edge of the auto-place region within the containing visual element.

Example: result = this.autobottom
Example: this.autobottom = 420

autoleft (Left, Right, Number) Accesses the position of the left edge of the auto-place region within the containing visual element.

Example: result = this.autoleft
Example: this.autoleft = 42

autoright (Left, Right, Number) Accesses the position of the right edge of the auto-place region within the containing visual element.

Example: result = this.autoright
Example: this.autoright = 420

autowidth (Left, Right, Number) Accesses the width of the auto-place region within the containing visual element.

Example: result = this.autowidth
Example: this.autowidth = 420

autoheight (Left, Right, Number) Accesses the height of the auto-place region within the containing visual element.

Example: result = this.autoheight
Example: this.autoheight = 420

autogap (Left, Right, Number) Accesses the default gap size used when automatically placing elements within the containing visual element. The "autogap" defaults to zero.

Example: result = this.autogap
Example: this.autogap = 42

autoplace[gap] (Right, Number) Automatically places the portal within the containing layout, subject to the standard rules for automatic placement. The gap parameter specifies the gap to be used between this portal and the previously placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Automatic placement for portals can only be used within layouts. A value of zero is always returned.

Example: perform this.autoplace[42]
Example: perform this.autoplace

batchadd[gap] (Right, Number) Queues the portal for batch placement within the containing layout, subject to the standard rules for batch placement. As with "autoplace", the gap parameter specifies the gap to be used between this portal and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Batch placement for portals can only be used within layouts. A value of zero is always returned.

Example: perform this.batchadd[42]
Example: perform this.batchadd