Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
Howdy!
I have a table of weapons where every weapon is coming out with two lines, when the notes portal should be multiline and make each weapon a different height: Code:
<!-- zWeapon portal This is a table of all Weapons carried by the actor. Weapons use the same template for both the contents and the header across the top. See the template for more details on this. --> <portal id="zWeapon" style="outNormal"> <output_table component="WeaponBase" showtemplate="zWeapPick" headertemplate="zWeapPick" showsortset="Armory" varyheight="yes"> <list><![CDATA[ !component.MagicItem ]]></list> </output_table> </portal> Code:
<portal id="notes" style="outTinyLt"> <output_label field="wpNotes" ismultiline="yes"> </output_label> </portal> Code:
<position><![CDATA[ ~our height is based on the tallest portal within ~if (field[wpNotes].isempty = 0) then ~set out portal height to automatically size as needed perform portal[notes].autoheight notify "portal - " & portal[notes].height ~our height is the height of our portal ~height = portal[notes].bottom height = portal[name].height + portal[notes].height + 5 notify "overall - " & height ~else ~height = portal[name].height + 5 ~endif ~place the name and indicators at the top, and the notes underneath portal[name].top = 0 perform portal[badstr].alignrel[btob,name,0] perform portal[special].alignrel[ttob,name,0] perform portal[notes].alignrel[ttob,name,0] ~position the other portals with the same baseline as the name; since they ~use a smaller font, they will have a smaller height, so centering them will ~make them appear to float up relative to the name perform portal[attack].alignrel[btob,name,0] perform portal[damage].alignrel[btob,name,0] perform portal[ap].alignrel[btob,name,0] perform portal[range].alignrel[btob,name,0] perform portal[dots].alignrel[btob,name,0] ~establish suitable fixed widths for the various columns of data portal[attack].width = 135 portal[damage].width = 195 portal[ap].width = 50 portal[range].width = 225 ~ portal[notes].width = width ~assign the name the remaining horizontal space ~Note: We must also account for a gap of 5 between portals. portal[name].width = width - 4 * 5 portal[name].width -= portal[attack].width + portal[damage].width portal[name].width -= portal[ap].width + portal[range].width ~position our columns now, except for the name portal[attack].left = portal[name].right + 5 perform portal[damage].alignrel[ltor,attack,5] perform portal[ap].alignrel[ltor,damage,5] perform portal[range].alignrel[ltor,ap,5] portal[special].left = portal[name].left + 10 portal[notes].left = portal[special].right ~setup to track our position when positioning portals along the x-axis var x as number x = 0 ~if the weapon satisfies the minimum strength requirement, hide the bitmap, ~else position it on the left if (tagis[Helper.BadStrReq] = 0) then portal[badstr].visible = 0 else portal[badstr].left = 0 x = portal[badstr].right endif ~if there are no special details for the weapon, hide the bitmap if (field[wpNotes].isempty = 1) then portal[special].visible = 0 portal[notes].visible = 0 endif ~shrink the space for the name based on the presence of the two bitmaps portal[name].width -= portal[badstr].width * portal[badstr].visible ~ portal[name].width -= portal[special].width * portal[special].visible ~size the name to fit the available space, then reposition it at the baseline ~Note: This is needed since smaller text will have the same top position. perform portal[name].sizetofit[36] perform portal[name].autoheight perform portal[name].alignrel[btob,attack,0] ~recalculate the width of the name based on the sized font ~Note: This is needed so we can determine the span for the row of dots. ~Note: We must also cap the name portal to its previous width, just in case ~ the "sizetofit" didn't shrink the name far enough to fully fit. var limit as number limit = portal[name].width perform portal[name].autowidth if (portal[name].width > limit) then portal[name].width = limit endif ~position the name and special details indicator portals horizontally now portal[name].left = x x = portal[name].right ~ if (portal[special].visible <> 0) then ~ portal[special].left = x ~ x = portal[special].right ~ endif ~extend the dots from the right of the name across to the attack portal if (x > portal[attack].left - 10) then portal[dots].visible = 0 else portal[dots].left = x + 5 portal[dots].width = portal[attack].left - 5 - portal[dots].left endif ]]></position> Thoughts, suggestions? THanks! TC Working on - |
#1 |
Thread Tools | |
Display Modes | |
|
|