View Single Post
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old March 27th, 2018, 07:12 AM
I'm working on my character sheet and I'm running into a minor issue of alignment. I want the fields left-aligned with the name without a border and the others with, but as you can see, all of them are getting a border, and only the value is left-aligned with the other fields centering for some reason. I'm displaying it all in an output_table, which does have outNormal set for its style, which has borders, but that doesn't explain why the alignment is different for one field.



Code:
<!-- simple text for output -->
  <style
    id="outNormal"
    border="bubble">
    <style_output
      textcolor="000000"
      font="ofntnormal"
      alignment="left">
      </style_output>
    </style>

<style
  id="outNormLt">
  <style_output
    textcolor="000000"
    font="ofntnormal"
    alignment="left">
    </style_output>
  </style>

<!-- left-aligned for output with border-->
<style
  id="outBNormLt"
  border="bubble">
  <style_output
    textcolor="000000"
    font="ofntnormal"
    alignment="left">
    </style_output>
  </style>
Code:
<portal
id="oCSkills"
style="outNormal">
  <output_table 
    component="Skill" 
    showtemplate="oSkillPick">
    <list><![CDATA[
      Skills.Combat 
      ]]></list>
    <headertitle><![CDATA[
      @text="Combat Skills"
    ]]></headertitle>
    </output_table>
</portal>
Code:
<template
  id="oSkillPick"
  name="Output Skills Table"
  compset="Skill"
  marginhorz="2"
  marginvert="2">

  <portal
    id="name"
    style="outNormLt">
    <output_label
      field="name">
      </output_label>
    </portal>

  <portal
    id="value"
    style="outBNormLt">
    <output_label
      field="trtFinal">
      </output_label>
    </portal>

  <portal
    id="special"
    style="outBNormLt">
    <output_label
      field="sklSpecs">
      </output_label>
    </portal>

  <position><![CDATA[
    ~our height is the height of the tallest portal
    height = portal[name].height
    doneif (issizing <> 0)

    ~position the name to the left and let it take up a third of the space.
    portal[name].left = 0
    portal[name].width = width / 3
    
    ~position the value to the right of that, and a ninth of the space
    portal[value].left = portal[name].right + 5
    portal[value].width = width / 9
    
    ~ Let the Specialties take up the rest of the space
    portal[special].left = portal[value].right + 50
    portal[special].width = width - portal[special].left

    ~size the name to fit the available space
    perform portal[name].sizetofit[20]
    perform portal[special].sizetofit[16]
    
    ~center all portals vertically
    perform portal[name].centervert
    perform portal[value].centervert
    perform portal[special].centervert
    ]]></position>

  </template>
Attached Images
File Type: png Skills.PNG (15.2 KB, 38 views)
Duggan is offline   #1 Reply With Quote