<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- This file contains the definition of the "Gadget" tab panel. This tab is where
the user selects general Gadget (non-weapons) for the character.
All public visual elements used with this tab panel start with the prefix "gr"
to associate them with the tab.
-->
<document signature="Hero Lab Data">
<!-- grGadget portal
Presents a dynamic table where the user can add Gadget for the character.
We use separate templates for selecting Gadget and showing the Gadget that has
been chosen. Each of these appears further below.
We use an "additem" script to simply prompt the user to add Gadget.
The "buytemplate" and "selltemplate" attributes hook in the logic for
properly buying and selling Gadget for cash.
We use a "headertitle" script to place a suitable title above the table.
The "list" tag expression restricts everything to only equipment (e.g. no
weapons). The "candidate" tag expression is omitted, resulting in the same
contents as the "list" tag expression.
-->
<portal
id="grGadget"
style="tblNormal">
<table_dynamic
component="Gadget"
showtemplate="grGtPick"
choosetemplate="grGtThing">
<list>component.Gadget</list>
<titlebar><![CDATA[
@text = "Select Gadget"
]]></titlebar>
<headertitle><![CDATA[
@text = "Gadgets"
]]></headertitle>
<additem><![CDATA[
@text = "Add New Gadget"
]]></additem>
</table_dynamic>
</portal>
<!-- grGtThing template
Derived from the SimpleItem template, this includes the purchase cost and
the lotsize of the item to be purchased.
-->
<template
id="grGtThing"
name="Gadget Thing"
compset="Equipment"
marginhorz="3"
marginvert="2">
<portal
id="name"
style="lblNormal">
<label>
<labeltext><![CDATA[
@text = field[name].text
]]></labeltext>
</label>
</portal>
<portal
id="cost"
style="lblNormal">
<label>
<labeltext><![CDATA[
@text = tagvalue[StoryCost.?]
]]></labeltext>
</label>
</portal>
<position><![CDATA[
~set up our dimensions, with a width that we dictate
height = portal[name].height
width = 250
~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)
~position the cost portal on the far right
perform portal[cost].alignedge[right,0]
~position the name on the left and let it use all available space
portal[name].left = 0
portal[name].width = minimum(portal[name].width,portal[cost].left - 10)
]]></position>
</template>
<!-- grGtPick template
Derived from the SimpleItem template, this includes the Gadget button to move
equipment between various containers.
-->
<template
id="grGtPick"
name="Gadget Pick"
compset="Equipment"
marginhorz="3"
marginvert="3">
<portal
id="name"
style="lblLeft"
showinvalid="yes">
<label
field="name">
</label>
</portal>
<portal
id="username"
style="editNormal">
<edit
field="UserName"
maxlength="100">
</edit>
</portal>
<portal
id="edit"
style="actEdit"
tiptext="Edit Gadget">
<action
action="edit"
buttontext="">
</action>
</portal>
<portal
id="info"
style="actInfo">
<action
action="info">
</action>
<mouseinfo/>
</portal>
<portal
id="delete"
style="actDelete"
tiptext="Click to delete this equipment">
<action
action="delete">
</action>
</portal>
<position><![CDATA[
~set up our height based on our tallest portal
height = portal[info].height
~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)
~center the portals vertically
perform portal[name].centervert
perform portal[username].centervert
perform portal[edit].centervert
perform portal[info].centervert
perform portal[delete].centervert
~position the delete portal on the far right
perform portal[delete].alignedge[right,0]
~position the info portal to the left of the delete button
perform portal[info].alignrel[rtol,delete,-8]
~position the info portal to the left of the delete button
perform portal[edit].alignrel[rtol,info,-8]
~position the name on the left and let it use all available space
var limit as number
limit = portal[edit].left - 8
portal[name].left = 0
portal[name].width = minimum(portal[name].width,limit)
~if this is a "custom" Gadget pick, show an edit portal instead of the name
var nextleft as number
if (tagis[Helper.CustomItem] <> 0) then
portal[name].visible = 0
portal[username].left = portal[name].left
portal[username].width = minimum(200,limit)
nextleft = portal[username].right
else
portal[username].visible = 0
nextleft = portal[name].right
endif
nextleft += 5
~if the Gadget can't be deleted (i.e. it's been auto-added instead of user-added,
~set the style to indicate that behavior to the user
if (candelete = 0) then
perform portal[name].setstyle[lblAuto]
endif
]]></position>
</template>
<!-- Gadget layout
This layout orchestrates the display of the visual elements that comprise
the Gadget tab. This amounts to a title and a table that allow the user to
add Gadget to the character.
The logic for this layout is similar to preceeding tabs, so please refer
to those tabs for more details.
-->
<layout
id="gadget">
<portalref portal="grGadget" taborder="10"/>
<!-- This script sizes and positions the layout and its child visual elements. -->
<position><![CDATA[
~position and size the table to span the full layout
perform portal[grGadget].autoplace
]]></position>
</layout>
<!-- Gadget panel
This is the "Gadget" panel shown within Hero Lab. Since we want this panel to
appear second within the second grouping (equipment), we assign it an
"order" of 220.
The logic for this panel is similar to the logic for the preceeding panels,
so please refer to those panels for more details.
<live>!HideTab.gadget</live>
-->
<panel
id="gadget"
name="Gadget"
marginhorz="5"
marginvert="5"
order="220">
<layoutref layout="gadget"/>
<position><![CDATA[
]]></position>
</panel>
</document>