PDA

View Full Version : Comprehensive Lists



Stitched
September 3rd, 2010, 21:33
Hi guys,

I'm trying to create user built list; add an entry, as needed, that contain a set of data on a line.

The below code is retro-fitted from the "special abilities" handler already found in the D20_JPG ruleset. So far, however, I have had no luck getting the "add entry" icon to appear.



<windowclass name="charsheet_attackitem">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<specialabilitynumber name="number">
<anchored>
<right>
<anchor>right</anchor>
</right>
<top>
<anchor>top</anchor>
</top>
<size>
<width>30</width>
<height>16</height>
</size>
</anchored>
<font>sheetnumbersmall</font>
<frame>
<name>modifier</name>
<offset>4,4,4,4</offset>
</frame>
</specialabilitynumber>

<specialabilitydice name="dice">
<anchored>
<right>
<parent>number</parent>
<anchor>left</anchor>
</right>
<top>
<anchor>top</anchor>
</top>
<size>
<width>35</width>
<height>15</height>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>4,4,4,5</offset>
</frame>
</specialabilitydice>

<textlistitemvalue name="value">
<anchored>
<left>
<anchor>left</anchor>
<offset>2</offset>
</left>
<right>
<parent>dice</parent>
<anchor>left</anchor>
<offset>-2</offset>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
<script>
function onDrop(x, y, draginfo)
if draginfo.isType("number") then
window.number.enable(true);
window.number.setSourceValue(draginfo.getNumberDat a());
return true;
end

if draginfo.isType("dice") then
window.dice.enable(true);
window.dice.setSourceValue(draginfo.getDieList());
return true;
end
end
</script>
</textlistitemvalue>
</sheetdata>
</windowclass>

<genericcontrol name="attackframe">
<bounds>15,410,-25,100</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<stringcontrol name="attacklabel">
<anchored>
<to>attackframe</to>
<position>insidetop</position>
<offset>0,10</offset>
</anchored>
<font>sheetlabel</font>
<static>Attacks</static>
<center />
</stringcontrol>

<windowlist name="attacklist">
<anchored>
<to>attackframe</to>
<position>over</position>
<offset>-12,-9</offset>
<top>
<parent>attackframe</parent>
<offset>30</offset>
</top>
</anchored>
<datasource>.attacklist</datasource>
<class>charsheet_attackitem</class>
<allowcreate />
<allowdelete />
<script file="scripts/charsheet_abilities.lua" />
</windowlist>

Moon Wizard
September 4th, 2010, 00:29
Are all those pieces of code in that order in your file? If so, you can't nest windowclasses.

Also, I'm not seeing any reference to an "add entry" icon anywhere in the code.

Regards,
JPG

Stitched
September 4th, 2010, 10:53
This is the order that it appears in the D20_JPG. Was using the "charsheet_abilities" code as a test in adding user-built lists; which contains no add_entry icon reference.

So what should I use instead of windowclass (if it's nested in the main code for charsheet_main?)


Are all those pieces of code in that order in your file? If so, you can't nest windowclasses.

Also, I'm not seeing any reference to an "add entry" icon anywhere in the code.

Regards,
JPG

Stitched
September 4th, 2010, 12:59
I think something clicked...

So all list declarations have to be OUTSIDE the main <windowclass> declaration; like the language list in "charsheet_mail.xml"



<windowclass name="charsheet_languagelistitem">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<textlistitemvalue name="name">
<anchored>
<left>
<anchor>left</anchor>
</left>
<right>
<anchor>right</anchor>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
</textlistitemvalue>
</sheetdata>
</windowclass>

<windowclass name="charsheet_main">


So as long as I move my weapon list declaration here, the formatting should be correct and it will no longer be nested?

Moon Wizard
September 4th, 2010, 18:34
Yes, all "list item" declarations need to be in their own separate windowclass.

The windowlist will just be a control in another window that references the item windowclass.

Cheers,
JPG

Stitched
September 4th, 2010, 19:07
Cool. Once I figured that out and moved all the code to declare before the main sheet call, it started working.