PDA

View Full Version : Problem with windowlists and the fillwidth option



phantomwhale
November 7th, 2010, 21:15
I have been looking into fixing a problem that manifests in multiple places in the Savage Worlds ruleset, namely when you have a skill name that is too long in the NPC or PC sheets, then the dice and string box to the right hand side can become impossible to select / drag from or drop to.

E.g. create a new NPC in Savage worlds. Give him two skills, one called aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa and once called bbbbbbbbbbbbbbbbbbbbbb. Now try and select the dice or edit the name of the second skill - you won't be able to. Also, when right-clicking to delete a right hand element, you will remove the left hand element, as this it's "Zone of control" has overshot the displayed boundaries.

Distilling this down to get to the root cause, it seems built into the core windowlist rendering somehow. Creating a mocked up basic 2 column window list with a simple string entry field, I recreated this problem.

Of course, looking around for how this might be overcome in the 4E / 3.5E rulesets, I found out - they don't use multi-column windowlists ever !

Below is the code fragments of the mockup window list I was experimenting with, complete with all my odd attempts at curtailing the "zone of control" from going outside the column :



<windowclass name="basicentry">
<size>
<width>120</width>
</size>
<sizelimits>
<minimum>
<width>120</width>
<height>20</height>
</minimum>
</sizelimits>
<sheetdata>
<stringfield name="name">
<bounds>5,0,115,20</bounds>
<font>sheettext</font>
<frame>
<name>textline</name>
<offset>2,0,2,0</offset>
</frame>
</stringfield>
</sheetdata>
</windowclass>

<windowlist name="basiclist">
<anchored>
<left>
<anchor>left</anchor>
</left>
<top>
<anchor>top</anchor>
<offset>35</offset>
</top>
<size>
<width>240</width>
</size>
</anchored>
<columns>
<width>120</width>
<fillwidth />
</columns>
<class>basicentry</class>
<datasource>.entries</datasource>
<allowcreate />
<allowdelete />
<script>
function onInit()
createWindow()
end
</script>
</windowlist>

Ikael
November 7th, 2010, 21:45
When using multi-column windowlists you should remember to setup the maximum width for your windowlist item, ie:

This is what I have put on my version of charsheet_skillentry windowclass.

<sizelimits>
<minimum>
<height>40</height>
<width>155</width>
</minimum>
<maximum>
<width>155</width>
</maximum>
</sizelimits>



Otherwise your windowlist items might collapse to each other. You can debug this by setting up the setFrame("rowshade") for the windowlist item's root window.

You should also setup the minimum width is your item has fixed width as for some way (haven't been able to reproduce it yet) if you don't setup it up, it might go wrong in some cases.

phantomwhale
November 7th, 2010, 21:57
Was about to protest that I had already set the maximum size limits... but then I saw that I'd set the MINIMUM size limits by accident !

Wonderful - that's fixed up now. Thanks Ikael :)

Lesson here : Always show your working and post your code fragments !!