PDA

View Full Version : problem with formatting of windowlist



Luc Tremblay
October 21st, 2007, 23:56
Hello!

I am new to Fantasy Grounds and I have been toying around with modding it for the last few days. I have to say it is pretty neat and I am having a lot of fun.

I have, though, stumbled on a little issue I think you guys can help me with.

As a little experiment, I am trying to create a window list of labels from a set of strings. To do this I have created a window class for an entry, containing a label...


<windowclass name="list_entry">
<sheetdata>
<stringcontrol name="label">
<bounds>0,0,50,20</bounds>
<font>sheetlabel</font>
<static />
<sizelimits>
<maximum>
<height>20</height>
<width>50</width>
</maximum>
</sizelimits>
</stringcontrol>
</sheetdata>
</windowclass>


Then I created a window list instanciating a bunch of these entries on its Init pass :


<windowclass name="list">
<sheetdata>
<windowlist name="list">
<bounds>0,0,300,300</bounds>
<frame>
<name>sheetgroup</name>
</frame>
<skipempty />

<class>list_entry</class>
<script>
function onInit()
local labelTest = createWindow();
labelTest.label.setValue("test1");
labelTest = createWindow();
labelTest.label.setValue("test2");
labelTest = createWindow();
labelTest.label.setValue("test3");
labelTest = createWindow();
labelTest.label.setValue("test4");
labelTest = createWindow();
labelTest.label.setValue("test5");
end
</script>
</windowlist>
</sheetdata>
</windowclass>


The problem is that each string is separated vertically by very large spacing, and it simply doesn't look right. I have tried many things to fix this, (see sizelimits settings I added, for example), but nothing seems to work.

https://www.tons-of-slack.net/windowlistbug.jpg

Any ideas from anyone on this?

It could be that onInit is too "early" for the formatting pass, but that sounds a bit far-fetched... please help me! :confused:

kalmarjan
October 22nd, 2007, 01:37
Your problem is not from the script. You have a bounds of 0,0 for your label, try 0,3 or 0,5 as your x,y coordinates.

Hope that helps.

Sandeman

Luc Tremblay
October 22nd, 2007, 02:07
You mean, replace :


<stringcontrol name="label">
<bounds>0,0,50,20</bounds>


with


<stringcontrol name="label">
<bounds>0,5,50,20</bounds>


?

If so, that doesn't work any better. In fact, the screenshot I attached was taken with 10,10,50,20 as bounds coordinates for the label, in order to avoid overlapping the frame. I tried many x, y coordinates but all give the same results : too much vertical spacing between each label. I would have thought that it was the second pair of coordinates that would influence this, being width and height, but changing them doesn't work either. :confused:

Luc Tremblay
October 22nd, 2007, 04:31
Agh. I found the problem.

The catch is twofold, for those interested.

First, a class used as a windowlist entry needs to declare sizelimit settings at the top level of the windowclass declaration. Those inside <sheetdata> are ignored.

Also, it is the <minimum> settings that you have to adjust in order to reduce the gaps, not <maximum>. Changing <maximum> settings has no effect.

So the code for the entry declaration should actually go like this :


<windowclass name="list_entry">
<sizelimits>
<minimum>
<height>20</height>
</minimum>
</sizelimits>
<sheetdata>
<stringcontrol name="label">
<bounds>0,0,50,20</bounds>
<font>sheetlabel</font>
<static />
</stringcontrol>
</sheetdata>
</windowclass>

Foen
October 22nd, 2007, 06:28
The sizelimits section in the windowclass controls the size of the list entries, the one in the stringcontrol just affects the label (within the entry) not the entry itself.

You can get a better idea about what is going on by adding a frame tag to the windowclass (before the sheetdata section) to show the list entries. The frame chatboxhilight should be good for this. You can remove the frame tags once you're happy with the rendering/layout.

Cheers

Stuart