<position><![CDATA[
autogap = 15
~since our table uses a needtag expression to determine what can be shown
~we'll fix the table if there are no powers available for selection
if (container.tagis[OptPower.?] + container.tagis[Hero.AllySpirit] = 0) then
portal[poPower].freeze = 1
endif
if (container.tagis[InnateAvl.?] + container.tagis[HasInnate.?] + container.tagis[Hero.SpirInnate] <> 0) then
~but if we're not allowed to choose more, freeze the table
if (container.tagis[InnateAvl.?] + container.tagis[Hero.SpirInnate] = 0) then
portal[poSpells].freeze = 1
endif
else
portal[poSpells].visible = 0
endif
if (portal[poPower].itemcount = 0) then
portal[poPower].visible = 0
endif
if (portal[poWeakness].itemcount = 0) then
portal[poWeakness].visible = 0
endif
if (container.tagexpr[SpiSklCat.? | SpiSklAllw.?] = 0) then
portal[poActSkill].visible = 0
endif
portal[poDefAttr].width = 250
perform portal[poRace].centerhorz
perform portal[poDefAttr].centerhorz
if (container.tagis[TemplatCat.?] + portal[poTemplate].itemcount = 0) then
portal[poTemplate].visible = 0
perform portal[poDefAttr].alignrel[ttob,poRace,10]
else
portal[poTemplate].width = width
perform portal[poTemplate].alignrel[ttob,poRace,10]
perform portal[poDefAttr].alignrel[ttob,poTemplate,10]
endif
perform portal[poDefAttr].centerhorz
autotop = portal[poDefAttr].bottom + 10
~since it's possible, even after using batchplace, for the form's
~height to exceed the available height, we want to record what the autotop
~was at this point, so we can re-use it later if we need to reset the
~arrangement
var oldautotop as number
oldautotop = autotop
perform portal[poPower].batchadd
perform portal[poActSkill].batchadd
perform portal[poWeakness].batchadd
perform portal[poSpells].batchadd
perform batchplace
~if there wasn't actually enough space to show all those portals, then
~we reset our autotop, and then set the height to a really large number.
~then, re-do the batchplace with that new larger amount of space. The
~result will be a scrollbar for the whole form, and no scrollbars on the
~individual tables
if (autotop > autobottom) then
autotop = oldautotop
height = 10000
autobottom = 10000
perform portal[poPower].batchadd
perform portal[poActSkill].batchadd
perform portal[poWeakness].batchadd
perform portal[poSpells].batchadd
perform batchplace
endif
height = autotop
]]></position>