PDA

View Full Version : Windowlist/class help.



tdwyer11b
July 12th, 2007, 23:50
I'm trying to set my skill frame up so I can right click "add entry" for the skills. Anyone see where I'm goofing up?

Here's a screenie testing it:

https://img67.imageshack.us/img67/1755/untitledka5.png

I keep getting -

Ruleset Warning: Anchored control static height ignored
Ruleset Warning: Anchored control static width ignored.

Here's the windowclass


<windowclass name="charsheet_skillentry">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<textlistitemvalue name="skill_name">
<anchored>
<left>
<anchor>left</anchor>
<offset>0</offset>
</left>
<right>
<anchor>left</anchor>
<offset>185</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
</script>
</textlistitemvalue>
<numberfield name="skill_score">
<font>sheetnumbersmall</font>
<anchored>
<to>skill_name</to>
<position>right</position>
<offset>7,0</offset>
<size>
<width>20</width>
<height>15</height>
</size>

</anchored>
<frame>
<name>textlinesmall</name>
<offset>0,-2,0,0</offset>
</frame>
</numberfield>
<checkbox name="exp1">
<anchored>
<to>skill_name</to>
<position>belowleft</position>
<offset>0,0</offset>
<size>
<width>15</width>
<height>15</height>
</size>
</anchored>
</checkbox>
</sheetdata>
</windowclass>

...and the windowlist


<genericcontrol name="skillframe">
<bounds>15,180,245,305</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>
<stringcontrol name="skilllabel">
<anchored>
<to>skillframe</to>
<position>insidetop</position>
<size>
<width>45</width>
<height>27</height>
</size>
<offset>-15,9</offset>
</anchored>
<font>sheetlabel</font>
<static>SKILLS</static>
</stringcontrol>
<windowlist name="skilllist">
<class>charsheet_skillentry</class>
<anchored>
<to>skillframe</to>
<position>insidetop</position>
<offset>-15,22</offset>
</anchored>
<allowcreate />
<allowdelete />
</windowlist>
<scrollercontrol>
<anchored>
<to>skillframe</to>
<position>insidebottomright</position>
<size>
<width>45</width>
<height>27</height>
</size>
</anchored>
<target>skilllist</target>
<button>
<normal>button_scroller</normal>
<pressed>button_scroller_down</pressed>
</button>
</scrollercontrol>

joshuha
July 12th, 2007, 23:56
Its just a warning and should still work ok. I believe when you using an <anchored> and the shorthand <to> tag it assumes the same size as the control its anchoring to. Thus it is ignoring your <size> tags and letting you know.

tdwyer11b
July 13th, 2007, 00:00
WOW! That was quick! Your right it does work, but it slows down the sheet from loading up. So basically I only have to define the first set of controls and the ones after will assume the attributes they are anchored to?

joshuha
July 13th, 2007, 00:25
Yes so make sure that anchoring control has something defined for size. In your example above the checkbox is seeing the numberfield has a width/heigth defined so it ignores its tag and is using the numberfield size.

Even though the numberfield is anchored to the skill name since the name doesn't specify a size it doesn't complain there. Does that make more sense?

tdwyer11b
July 13th, 2007, 00:57
In your example above the checkbox is seeing the numberfield has a width/heigth defined so it ignores its tag and is using the numberfield size.

I'm not sure how the checkbox is seeing the numberfield when it's anchored to the textlistitemvalue. Or does it read the values of the item right before it?


<checkbox name="exp1">
<anchored>
<to>skill_name</to>
<position>belowleft</position>
<offset>0,0</offset>
<size>
<width>15</width>
<height>15</height>
</size>
</anchored>
</checkbox>

Also, any idea why none of the information I enter saves? I've even tried using /save on the chat panel, doesn't work.

Toadwart
July 13th, 2007, 03:43
Also, any idea why none of the information I enter saves? I've even tried using /save on the chat panel, doesn't work.

Think you just need to specify a <datasource> tag in your charsheet_skillentry windowclass.

joshuha
July 13th, 2007, 03:46
I'm not sure how the checkbox is seeing the numberfield when it's anchored to the textlistitemvalue. Or does it read the values of the item right before it?

Oops sorry I misread that. Hmm, lemme think more on the warnings then. If it was the case of the skill_name being the offending bounds you should be getting those errors for each control but I only see it once.



Also, any idea why none of the information I enter saves? I've even tried using /save on the chat panel, doesn't work.

Toadwart has the correct answer. The datasource needs to be there for the windowlist.

tdwyer11b
July 13th, 2007, 04:21
Hmmm, I added <datasource>.skillentry</datasource> to the windowlist and none of my entries show up now. Do I need to define this elsewhere as well?

Foen
July 13th, 2007, 06:34
The skill_score numberfield is generating the height warning: when you anchor 'right' the child control takes the height of its anchor and you only need to specify the width. I'm not so sure about the width warning(s), is there only one or more than one of them?

As regards linking the checkbox, it depends on the database structure. Typically the windowlist would be tied to 'skills' or something, then the windowclass controls would be tied to 'name', 'score' and 'exp'. The windowclass controls don't need explicit source attributes as the name of the control is the default name of the underlying db source.

In this example, you would end up with a db along the lines of:


<skills>
<id-00001>
<name type='string'>My first skill</name>
<score type='number'>25</score>
<exp type='number'>1</exp>
</id-00001>
<id-00002>
<name type='string'>My other skill</name>
<score type='number'>10</score>
<exp type='number'>0</exp>
</id-00002>
</skills>

Have a look in your campaign db.xml to see what is/has been going on.

Cheers

Stuart
(Foen)

Foen
July 13th, 2007, 07:54
Sorry tdwyer11b, here is a more complete (and correct answer).

The insidetop anchor fixes the width of the control, so any width attribute of size causes a problem. I have re-worked your code, and here is an amended windowclass:



<windowclass name="charsheet_skillentry">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<sheetdata>
<textlistitemvalue name="name">
<anchored>
<left>
<anchor>left</anchor>
<offset>0</offset>
</left>
<right>
<anchor>left</anchor>
<offset>185</offset>
</right>
<top>
<anchor>top</anchor>
</top>
<size>
<height>18</height>
</size>
</anchored>
<script>
function onLoseFocus()
super.onLoseFocus();
window.windowlist.applySort();
end
</script>
</textlistitemvalue>
<numberfield name="score">
<font>sheetnumbersmall</font>
<anchored>
<to>name</to>
<position>right</position>
<offset>7</offset>
<size>
<width>20</width>
</size>
</anchored>
<frame>
<name>textlinesmall</name>
<offset>0,-2,0,0</offset>
</frame>
</numberfield>
<checkbox name="exp">
<anchored>
<to>name</to>
<position>belowleft</position>
<size>
<width>15</width>
<height>15</height>
</size>
</anchored>
</checkbox>
</sheetdata>
</windowclass>


The windowlist and other sheetdata now looks like this



<genericcontrol name="skillframe">
<bounds>15,180,245,305</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>
<stringcontrol name="skilllabel">
<anchored>
<to>skillframe</to>
<position>insidetopleft</position>
<size>
<width>45</width>
<height>27</height>
</size>
<offset>15,9</offset>
</anchored>
<font>sheetlabel</font>
<static>SKILLS</static>
</stringcontrol>
<windowlist name="skilllist">
<class>charsheet_skillentry</class>
<datasource>.skills</datasource>
<anchored>
<to>skillframe</to>
<position>over</position>
<offset>-15,-22</offset>
</anchored>
<allowcreate />
<allowdelete />
</windowlist>
<scrollercontrol>
<anchored>
<to>skillframe</to>
<position>insidebottomright</position>
<size>
<width>45</width>
<height>27</height>
</size>
</anchored>
<target>skilllist</target>
<button>
<normal>button_scroller</normal>
<pressed>button_scroller_down</pressed>
</button>
</scrollercontrol>


The data it created in the campaign db.xml file was:



<skills>
<id-00001>
<exp type="number">1</exp>
<name type="string">Skill one</name>
<score type="number">34</score>
</id-00001>
<id-00002>
<exp type="number">0</exp>
<name type="string">Skill two</name>
<score type="number">25</score>
</id-00002>
</skills>


I've attached a thumbnail of the result.

Hope that helps

Stuart
(Foen)

tdwyer11b
July 15th, 2007, 04:15
Just wanted to say thanx guys, you're help saved my brain from melting.