PDA

View Full Version : Not the first straw to break the camels back



GMBazUK
April 12th, 2008, 09:47
Im trying (being the operative word), to create a template which will provide an alternative to the template which creates the text and line combo for name race etc, albeit with smaller text headings.


<template name="labeledstring">
<stringfield>
<font>sheettext</font>
<frame>
<name>textline</name>
</frame>
<script>
labelwidget = nil;

function onInit()
labelwidget = addTextWidget("sheetlabelinline", string.upper(label[1]));

local w,h = labelwidget.getSize();
labelwidget.setPosition("bottomleft", w/2, h/2-5);
end
</script>
</stringfield>
</template>

This is the xml and script responsible... I think.
What I have tried is:

Copying and renaming the template... Labeledstring small
reassigning the font to a smaller font I made myself and used successfully elsewhere
referencing the template in the corresponding xml for the sheet in question.

It doesnt work. The text size is the same as it was before.
In complete ignorance of Lua (and some might say xml), I have a sneaky feeling the script might be dictating the text size?
Could someone please explain briefly what the script is doing, and how I might accomplish my goal.
Thanks in advance.

Baz

unimatrixzero
April 12th, 2008, 10:40
Hi
I think just choosing a different sized font in your modified template would solve this problem.

just thought: When you changed the template name to 'labeledstringsmall' (you may need to omit the spacing) did you change the reference code in your charsheet_main to the same?
i.e.

<labeledstringsmall name="name">
<anchored>
<to>overviewframe</to>
<position>insidetopleft</position>
<offset>95,50</offset>
<size>
<width>130</width>
<height>20</height>
</size>
</anchored>
<anchorto>overviewframe</anchorto>
<height>20</height>
<label>name</label>
<font>hotkey</font>
<tabtarget>
<next>race</next>
<prev>title</prev>
</tabtarget>
</labeledstringsmall>

regards
Uni

GMBazUK
April 12th, 2008, 14:37
Thanks for your help Unimatrixzero. I had avoided the spaces, and altered the xml in the character_main.xml, but all that did was change the size of the text to be input rather than the label below the line such as name, race..etc

As before I think it may be some function of the Lua in the template but thats as far as my limited know-how will stretch.

Baz