Form Element (Data)

From HLKitWiki
Revision as of 12:04, 3 December 2008 by Rob (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … 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>