PDA

View Full Version : Having trouble with some changes



madman
August 23rd, 2010, 18:27
I am changing the character sheet in an extension. Adding some tabs to the inventory page. I can get the tabs to work. but the information is not being put into the tab it is made in.

inventorylist is made for each tab and with the bounds offset some, i can tell the frame is being rendered. but the list for each tab does not get created for that tab. I am not sure where i need to make changes.

Any help with this would be great.

Thanks
Chris



<root version="2.0">
<includefile source="charsheet_invequip.xml" />
<includefile source="charsheet_invarmorandweapons.xml" />
<includefile source="charsheet_invmagic.xml" />
<includefile source="charsheet_invconsumables.xml" />

<windowclass name="charsheet_inventoryitem">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>

Took out some code here for post because of length
and know this part should not be the problem
</sheetdata>
</windowclass>

<windowclass name="charsheet_inventory">
<placement>
<size>
<width>252</width>
<height>611</height>
</size>
</placement>
<script>
local parent = nil;

function registerParent(win)
parent = win;
end
</script>

<nodelete />
<sheetdata>

<subwindow name="charsheet_invequip">
<bounds>0,0,-1,-1</bounds>
<class>charsheet_invequip</class>
<activate/>
</subwindow>
<subwindow name="charsheet_invarmorandweapons">
<bounds>0,0,-1,-1</bounds>
<class>charsheet_invarmorandweapons</class>
<activate/>
</subwindow>
<subwindow name="charsheet_invmagic">
<bounds>0,0,-1,-1</bounds>
<class>charsheet_invmagic</class>
<activate/>
</subwindow>
<subwindow name="charsheet_invconsumables">
<bounds>0,0,-1,-1</bounds>
<class>charsheet_invconsumables</class>
<activate/>
</subwindow>

<tabcontrol name="tabs">
<bounds>10,15,18,300</bounds>
<tab>
<icon>tab_equip</icon>
<subwindow>charsheet_invequip</subwindow>
</tab>
<tab>
<icon>tab_armorandweapons</icon>
<subwindow>charsheet_invarmorandweapons</subwindow>
</tab>
<tab>
<icon>tab_magic</icon>
<subwindow>charsheet_invmagic</subwindow>
</tab>
<tab>
<icon>tab_consumables</icon>
<subwindow>charsheet_invconsumables</subwindow>
</tab>
<activate>1</activate>
</tabcontrol>

<!-- Inventory -->
<genericcontrol name="inventoryframe">
<bounds>25,20,480,355</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<stringcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetop</position>
<offset>0,11</offset>
</anchored>
<center />
<font>sheetlabel</font>
<static>Inventory</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>21,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>#</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>38,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Name</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>303,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Location</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>368,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Weight</static>
</stringcontrol>
<genericcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>411,17</offset>
<size>
<width>10</width>
<height>10</height>
</size>
</anchored>
<icon>indicator_encumbrance</icon>
<tooltip>
<text>Apply weight to encumbrance</text>
</tooltip>
</genericcontrol>
<genericcontrol>
<anchored>
<to>inventoryframe</to>
<position>insidetopleft</position>
<offset>430,17</offset>
<size>
<width>10</width>
<height>10</height>
</size>
</anchored>
<icon>indicator_quicklist</icon>
<tooltip>
<text>Show on mini sheet</text>
</tooltip>
</genericcontrol>

<windowlist name="inventorylist">
<anchored>
<to>inventoryframe</to>
<position>over</position>
<offset>-12,-9</offset>
<top>
<parent>inventoryframe</parent>
<offset>30</offset>
</top>
</anchored>
<datasource>.inventorylist</datasource>
<class>charsheet_inventoryitem</class>
<allowcreate />
<allowdelete />
<script file="scripts/charsheet_inventorylist.lua" />
</windowlist>
<scrollercontrol>
<anchored>
<to>inventorylist</to>
<position>insidebottomright</position>
<size>
<width>45</width>
<height>27</height>
</size>
</anchored>
<target>inventorylist</target>
<button>
<normal>button_scroller</normal>
<pressed>button_scroller_down</pressed>
</button>
</scrollercontrol>


Main Window



I am using d20_jpg 3.0.5/FG 2 2.6.5

madman
August 23rd, 2010, 18:29
<?xml version="1.0" encoding="iso-8859-1"?>


<root version="2.0">
<windowclass name="charsheet_invequip">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<jpgnumberfield name="count">
<anchored>
<left>
<anchor>left</anchor>
<offset>2</offset>
</left>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
<size>
<width>20</width>
<height>14</height>
</size>
</anchored>
<frame>
<name>textlinesmall</name>
<offset>0,0,0,0</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>6,5,6,5</offset>
</keyeditframe>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<nodrag />
<delaykeyupdate />
<script>
function onValueChanged()
window.windowlist.updateEncumbrance();
end
</script>
<tabtarget>
<next>name</next>
<prev>weight</prev>
</tabtarget>
</jpgnumberfield>
<inventorybonus name="bonus">
<anchored>
<right>
<anchor>right</anchor>
<offset>-190</offset>
</right>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
<size>
<width>25</width>
<height>14</height>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>6,5,6,5</offset>
</frame>
</inventorybonus>
<inventorydice name="dice">
<anchored>
<right>
<parent>bonus</parent>
<anchor>left</anchor>
<offset>-2</offset>
</right>
<top>
<anchor>top</anchor>
<offset>1</offset>
</top>
<size>
<width>35</width>
<height>15</height>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>4,4,4,5</offset>
</frame>
</inventorydice>
<textlistitemvalue name="name">
<anchored>
<left>
<anchor>left</anchor>
<offset>25</offset>
</left>
<right>
<parent>dice</parent>
<anchor>left</anchor>
<offset>-2</offset>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
<tabtarget>
<next>location</next>
<prev>count</prev>
</tabtarget>
<script>
function onLoseFocus()
super.onLoseFocus();
window.windowlist.applySort();
end

function onDrop(x, y, draginfo)
if draginfo.isType("dice") then
window.dice.enable(true);
window.dice.setSourceValue(draginfo.getDieList());
return true;
end
if draginfo.isType("number") then
window.bonus.enable(true);
window.bonus.setSourceValue(draginfo.getNumberData ());
return true;
end
end
</script>
</textlistitemvalue>
<textlistitemvalue name="location">
<anchored>
<left>
<parent>bonus</parent>
<anchor>right</anchor>
<offset>5</offset>
</left>
<top>
<anchor>top</anchor>
</top>
<size>
<width>80</width>
</size>
</anchored>
<nodelete />
<script file="scripts/charsheet_inventorylocation.lua" />
<tabtarget>
<next>weight</next>
<prev>name</prev>
</tabtarget>
</textlistitemvalue>
<jpgnumberfield name="weight">
<anchored>
<left>
<parent>location</parent>
<anchor>right</anchor>
<offset>7</offset>
</left>
<top>
<anchor>top</anchor>
<offset>2</offset>
</top>
<size>
<width>30</width>
<height>14</height>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>6,5,6,5</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>6,5,6,5</offset>
</keyeditframe>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<nodrag />
<delaykeyupdate />
<script>
function onValueChanged()
window.windowlist.updateEncumbrance();
end
</script>
<tabtarget>
<next>count</next>
<prev>location</prev>
</tabtarget>
</jpgnumberfield>
<checkbox name="carried">
<anchored>
<left>
<parent>weight</parent>
<anchor>right</anchor>
<offset>10</offset>
</left>
<top>
<anchor>top</anchor>
<offset>4</offset>
</top>
<size>
<width>12</width>
<height>12</height>
</size>
</anchored>
<script>
function onValueChanged()
if window.name.getValue() ~= "" then
for k, v in ipairs(window.windowlist.getWindows()) do
if v.location.getValue() == window.name.getValue() then
v.carried.setState(getState());
end
end
end

window.windowlist.updateEncumbrance();
end
</script>
</checkbox>
<checkbox name="showonminisheet">
<anchored>
<left>
<parent>carried</parent>
<anchor>right</anchor>
<offset>7</offset>
</left>
<top>
<anchor>top</anchor>
<offset>4</offset>
</top>
<size>
<width>12</width>
<height>12</height>
</size>
</anchored>
</checkbox>
<windowreferencefield name="shortcut">
<anchored>
<right>
<anchor>right</anchor>
<offset>-2</offset>
</right>
<top>
<anchor>top</anchor>
</top>
<size>
<width>20</width>
<height>20</height>
</size>
</anchored>
<icon>
<normal>button_openwindow</normal>
<empty>button_emptytarget</empty>
<pressed>button_emptytarget</pressed>
</icon>
<allowdrop />
</windowreferencefield>
</sheetdata>
</windowclass>

<windowclass name="charsheet_invequip">
<placement>
<size>
<width>252</width>
<height>611</height>
</size>
</placement>
<nodelete />
<sheetdata>
<!-- Inventory -->
<genericcontrol name="equipframe">
<bounds>25,20,480,355</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<stringcontrol>
<anchored>
<to>equipframe</to>
<position>insidetop</position>
<offset>0,11</offset>
</anchored>
<center />
<font>sheetlabel</font>
<static>Equipment</static>
</stringcontrol>

<stringcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>1,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>#</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>38,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Name</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>303,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Location</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>368,17</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Weight</static>
</stringcontrol>
<genericcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>411,17</offset>
<size>
<width>10</width>
<height>10</height>
</size>
</anchored>
<icon>indicator_encumbrance</icon>
<tooltip>
<text>Apply weight to encumbrance</text>
</tooltip>
</genericcontrol>
<genericcontrol>
<anchored>
<to>equipframe</to>
<position>insidetopleft</position>
<offset>430,17</offset>
<size>
<width>10</width>
<height>10</height>
</size>
</anchored>
<icon>indicator_quicklist</icon>
<tooltip>
<text>Show on mini sheet</text>
</tooltip>
</genericcontrol>

<windowlist name="inventorylist4">
<anchored>
<to>equipframe</to>
<position>over</position>
<offset>-12,-9</offset>
<top>
<parent>equipframe</parent>
<offset>30</offset>
</top>
</anchored>
<datasource>.inventorylist4</datasource>
<class>charsheet_inventoryitem</class>
<allowcreate />
<allowdelete />
<script file="scripts/charsheet_inventorylist.lua" />
</windowlist>
<scrollercontrol>
<anchored>
<to>inventorylist4</to>
<position>insidebottomright</position>
<size>
<width>45</width>
<height>27</height>
</size>
</anchored>
<target>inventoryequiplist</target>
<button>
<normal>button_scroller</normal>
<pressed>button_scroller_down</pressed>
</button>
</scrollercontrol>
</sheetdata>
</windowclass>
</root>

Sub window 1
the other sub windows use the same code.

the goal is just to have the inventory sorted for quicker access to some items

Thank
Chris

StuartW
August 24th, 2010, 06:14
It looks like your main window code still has the original inventory list in it, and because it renders after the subwindows, it is sitting on top of those subwindows (preventing you from accessing the individual lists).

For testing purposes, you might want to add a translucent frame (such as rowshade) to the various windowlists, so you can see where they are rendering.

Stuart

madman
August 25th, 2010, 07:17
Thank You for your help, i deleted the original and the new windows are there. Everything works great now.

Thanks Again for the help!

Chris