Form Element (Data): Difference between revisions

From HLKitWiki
Jump to navigationJump to search
New page: {{context|Kit Reference|Data File Reference}} ==The "form" Element== Forms contain one or more layouts and orchestrate the presentation of material within a standalo...
 
No edit summary
 
Line 12: Line 12:
|Text – Public name associated with the form. Maximum length of 50 characters.  
|Text – Public name associated with the form. Maximum length of 50 characters.  
|-
|-
|order
|showbutton
|(Optional) Integer Specifies the sequence in which this panel is displayed to the user. For a tab-based panel, this value controls the order in which the tabs are shown across the top. For a summary panel, this value controls the default order in which the summary panels are shown. Default: "0".
|(Optional) Boolean Indicates whether a button should be added at the bottom of the form that allows the user to close the form. Default: "yes".
|-
|-
|issummary
|entity
|(Optional) Boolean Indicates whether this panel is intended for use as a summary panel or a tab-based panel. Default: "no".
|(Optional) Id Specifies the unique of an entity for which this form is designed to edit the contents. If empty, the form cannot be used for editing any gizmos. Default: Empty.
|-
|-
|marginhorz
|marginhorz
Line 24: Line 24:
|(Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the panel is the actual height minus double the vertical margin. Default: "0".
|(Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the panel is the actual height minus double the vertical margin. Default: "0".
|-
|-
|underlay
|defwidth
|(Optional) Text – Specifies the filename of a bitmap image that is blitted on top of the background and beneath all other visual elements within the panel. This bitmap file is assumed to reside within the data file folder for the game system. If empty, no underlay bitmap is utilized. Default: Empty.
|(Optional) Integer – Specifies the default initial width to be used for the form. Default: "300".
|-
|-
|}
|defheight
 
|(Optional) Integer – Specifies the default initial height to be used for the form. Default: "300".
The "panel" element also possesses child elements that define various facets of the panel. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
|-
 
|minwidth
:{| class="infotable"
|(Optional) Integer – Specifies the minimum width to be enforced for the form. Default: "0".
|class="leftnormal"|[[#live|live]]
|-
|An optional "live" element may appear as defined by the given link. This element defines a [[Live Tag Expression]] that determines whether the panel is shown to the user.  
|minheight
|(Optional) Integer – Specifies the minimum height to be enforced for the form. Default: "0".
|-
|-
|[[#layoutref|layoutref]]
|maxwidth
|Zero or more "layoutref" elements may appear as defined by the given link. This element specifies the individual layouts which are utilized within the panel.
|(Optional) Integer – Specifies the maximum width to be enforced for the form. Default: "0".
|-
|-
|[[#position|position]]
|maxheight
|An optional "position" element may appear as defined by the given link. This element defines a [[Position Script]] through which the contained layouts are sized and positioned within the panel.
|(Optional) Integer – Specifies the maximum height to be enforced for the form. Default: "0".
|-
|-
|}
|}


==The "live" Element{{anchor|live}}==
The "form" element also possesses child elements that define various facets of the form. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
 
The "live" element defines a [[Live Tag Expression]] for the panel, which determines whether the panel is shown. The tag expression is compared against the tags assigned to the container associated with the panel (e.g. the actor). If the tag expression is satisfied, the panel is visible, else it is hidden. For tab panels, hidden implies that the tab itself does not appear. The complete list of attributes for this element is below.  


:{| class="infotable"
:{| class="infotable"
|class="leftnormal"|PCDATA
|class="leftnormal"|[[#layoutref|layoutref]]
|Script – Specifies the code comprising the Live tag expression.
|Zero or more "layoutref" elements may appear as defined by the given link. This element specifies the individual layouts which are utilized within the form.
|-
|[[#position|position]]
|An optional "position" element may appear as defined by the given link. This element defines a [[Position Script]] through which the contained layouts are sized and positioned within the form.
|-
|-
|}
|}
Line 55: Line 57:
==The "layoutref" Element{{anchor|layoutref}}==
==The "layoutref" Element{{anchor|layoutref}}==


The "layoutref" element identifies a layout used within the panel and assigns it a logical name for use within the Position script. The complete list of attributes for this element is below.  
The "layoutref" element identifies a layout used within the form and assigns it a logical name for use within the Position script. The complete list of attributes for this element is below.  


:{| class="infotable"
:{| class="infotable"
|class="leftnormal"|layout
|class="leftnormal"|layout
|Id – Unique id of the layout to be utilized within the panel.
|Id – Unique id of the layout to be utilized within the form.
|-
|-
|reference
|reference
|(Optional) Id – Specifies the alternate unique id to be used when referencing this layout within the Position script. This makes it possible to re-use the same layout more than once within the same panel, giving each instance a different logical id. If empty, the reference id is simply the layout id. Default: Empty.
|(Optional) Id – Specifies the alternate unique id to be used when referencing this layout within the Position script. This makes it possible to re-use the same layout more than once within the same form, giving each instance a different logical id. If empty, the reference id is simply the layout id. Default: Empty.
|-
|-
|}
|}
Line 68: Line 70:
==The "position" Element{{anchor|position}}==
==The "position" Element{{anchor|position}}==


The "position" element defines a [[Position Script]] for the panel, which performs all the appropriate sizing and positioning of the contained layouts within the panel. The complete list of attributes for this element is below.  
The "position" element defines a [[Position Script]] for the form, which performs all the appropriate sizing and positioning of the contained layouts within the form. The complete list of attributes for this element is below.  


:{| class="infotable"
:{| class="infotable"
Line 78: Line 80:
==Example==
==Example==


The following example demonstrates what a "panel" element might look like. All default values are assumed for optional attributes.
The following example demonstrates what a "form" element might look like. All default values are assumed for optional attributes.


<pre>
<pre>
<panel id="basics" name="Basics" order="110"
<panel id="config" name="Configure">
    marginhorz="5" marginvert="5">
   <layoutref layout="configure"/>
  <live>!HideTab.basics</live>
   <layoutref layout="basics"/>
   <position>
   <position>
     ~script code goes here
     ~render the layout to generate its dimensions
    perform layout[configure].render
    ~set the width and height of the form to the dimensions of the layout
    width = layout[configure].width
    height = layout[configure].height
     </position>
     </position>
   </panel>
   </panel>
</pre>
</pre>

Latest revision as of 12:04, 3 December 2008

Context: HL Kit &#133; Kit Reference &#133; Data File Reference 

The "form" Element

Forms contain one or more layouts and orchestrate the presentation of material within a standalone form within HL. Forms are used to define the contents of the Configure Hero form, the Tactical Console, and other visual pieces. Each form is specified through the use of a "form" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the form. This id is used in all references to the form.
name Text – Public name associated with the form. Maximum length of 50 characters.
showbutton (Optional) Boolean – Indicates whether a button should be added at the bottom of the form that allows the user to close the form. Default: "yes".
entity (Optional) Id – Specifies the unique of an entity for which this form is designed to edit the contents. If empty, the form cannot be used for editing any gizmos. Default: Empty.
marginhorz (Optional) Integer – Specifies the margin gap included at both ends along the horizontal axis. The usable width of the panel is the actual width minus double the horizontal margin. Default: "0".
marginvert (Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the panel is the actual height minus double the vertical margin. Default: "0".
defwidth (Optional) Integer – Specifies the default initial width to be used for the form. Default: "300".
defheight (Optional) Integer – Specifies the default initial height to be used for the form. Default: "300".
minwidth (Optional) Integer – Specifies the minimum width to be enforced for the form. Default: "0".
minheight (Optional) Integer – Specifies the minimum height to be enforced for the form. Default: "0".
maxwidth (Optional) Integer – Specifies the maximum width to be enforced for the form. Default: "0".
maxheight (Optional) Integer – Specifies the maximum height to be enforced for the form. Default: "0".

The "form" element also possesses child elements that define various facets of the form. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.

layoutref Zero or more "layoutref" elements may appear as defined by the given link. This element specifies the individual layouts which are utilized within the form.
position An optional "position" element may appear as defined by the given link. This element defines a Position Script through which the contained layouts are sized and positioned within the form.

The "layoutref" Element

The "layoutref" element identifies a layout used within the form and assigns it a logical name for use within the Position script. The complete list of attributes for this element is below.

layout Id – Unique id of the layout to be utilized within the form.
reference (Optional) Id – Specifies the alternate unique id to be used when referencing this layout within the Position script. This makes it possible to re-use the same layout more than once within the same form, giving each instance a different logical id. If empty, the reference id is simply the layout id. Default: Empty.

The "position" Element

The "position" element defines a Position Script for the form, which performs all the appropriate sizing and positioning of the contained layouts within the form. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Position script.

Example

The following example demonstrates what a "form" element might look like. All default values are assumed for optional attributes.

<panel id="config" name="Configure">
  <layoutref layout="configure"/>
  <position>
    ~render the layout to generate its dimensions
    perform layout[configure].render
    ~set the width and height of the form to the dimensions of the layout
    width = layout[configure].width
    height = layout[configure].height
    </position>
  </panel>