Thread: Some Windowlist problems...
-
January 16th, 2008, 13:25 #1
Some Windowlist problems...
I have a few small problems with a Windowlist I am using in my character-sheet.
First one would be that there is no description to the values if I drag them from the list... (And while I have the feeling that this is probably pretty EASY to fix... I haven't been able to figure it out. )
The second is more of a oddity, but I think it'd be easy to do a work-around.
If I create several empty lines, the numbers associated with them are not associated. And when I change one, others change as well. I imagine this has to do partially with the sorting algorithm and partially with the index for a blank line.
Either way... Is there any way to surpress the adding of new blank lines when you allready have one?
And finally... How to add all the XP costs together for it all to work properly?
Code:<windowclass name="charsheet_skilllistitem"> <sizelimits> <minimum> <height>18</height> </minimum> </sizelimits> <script file="scripts/charsheet_skilllistitem.lua" /> <sheetdata> <stringfield name="label"> <anchored> <left> <anchor>left</anchor> <offset>15</offset> </left> <top> <anchor>top</anchor> <offset>5</offset> </top> <size> <width>180</width> </size> </anchored> <font>sheetlabelsmall</font> <frame> <name>textline</name> <offset>0,5,0,0</offset> </frame> <script> function onEnter() window.windowlist.addNewInstance(window.label.getValue()); end function onDeleteUp() if getValue() == "" and window.ranks.getValue() == 0 then local target = window.windowlist.getPrevWindow(window); if target and target.label.getValue() == window.label.getValue() then target.sublabel.setFocus(); end window.getDatabaseNode().delete(); end end </script> </stringfield> <numberfield name="skill.level"> <anchored> <left> <anchor>left</anchor> <offset>200</offset> </left> <top> <anchor>top</anchor> <offset>2</offset> </top> <size> <width>25</width> </size> </anchored> <script> function onValueChanged() local test; local cost; cost = window.getDatabaseNode().getChild("skill.cost").getValue() test = window.getDatabaseNode().getChild("skill.level").getValue() window.getDatabaseNode().getChild("skill.xp").setValue( cost*((test^2)/2 +(test/2)) ); end function onEnter() window.windowlist.addNewInstance(window.label.getValue()); end </script> <stateframe> <hover> <name>sheetfocus</name> <offset>6,7,7,5</offset> </hover> <drophilight> <name>rowshade</name> <offset>1,1,1,1</offset> </drophilight> </stateframe> </numberfield> <numberfield name="skill.cost"> <anchored> <left> <anchor>left</anchor> <offset>230</offset> </left> <top> <anchor>top</anchor> <offset>2</offset> </top> <size> <width>25</width> </size> </anchored> <script> function onValueChanged() local test; local cost; cost = window.getDatabaseNode().getChild("skill.cost").getValue() test = window.getDatabaseNode().getChild("skill.level").getValue() window.getDatabaseNode().getChild("skill.xp").setValue( cost*((test^2)/2 +(test/2)) ); end function onEnter() window.windowlist.addNewInstance(window.label.getValue()); end </script> <stateframe> <hover> <name>sheetfocus</name> <offset>6,7,7,5</offset> </hover> <drophilight> <name>rowshade</name> <offset>1,1,1,1</offset> </drophilight> </stateframe> </numberfield> <numberfield name="skill.xp"> <anchored> <left> <anchor>left</anchor> <offset>260</offset> </left> <top> <anchor>top</anchor> <offset>2</offset> </top> <size> <width>25</width> </size> </anchored> <stateframe> <hover> <name>sheetfocus</name> <offset>6,7,7,5</offset> </hover> <drophilight> <name>rowshade</name> <offset>1,1,1,1</offset> </drophilight> </stateframe> </numberfield> </sheetdata> </windowclass>
Code:<windowlist name="skilllist"> <bounds rect="25,200,700,250" /> <datasource>.skilllist</datasource> <class>charsheet_skilllistitem</class> <allowcreate /> <columns> <filldown /> <width>350</width> </columns> <script file="scripts/charsheet_skilllist.lua" /> </windowlist>
-
January 16th, 2008, 14:18 #2
Ok first thing I would change is how you have the numberfields.
I would change:
<numberfield name="skill.level">
to
<numberfield name="skilllevel" source="skill.level">
This may be why they are all changing at the same time because I don't think the dot qualifiers are allowed in a name but in the source (i.e. the database) this will group them like you want.
In the windowlist control a <skipempty /> tag will prevent if from creating the default blank lines.
Also to get drag and drop working the easiest, your field names from the items you are trying to drop should be the same as the receiving control. Then add the following in the windowlist control (if your class you are dropping it from is called skill):
Code:<acceptdrop> <class>skill</class> <field>label</field> <field>skilllevel</field> </acceptdrop>
-
January 16th, 2008, 14:38 #3
The last problem is more when I drag from the list to the modifier box or chatbox... It will take the level, but not the name.
So the roll becomes nothing but a digit with no annotation on how it ended up so.
-
January 16th, 2008, 14:59 #4
In the numberfield put this:
Code:<description> <field>label</field> </description>
-
January 16th, 2008, 15:04 #5
THAT did the trick.
Thank you EVER so much Joshua.
-
January 16th, 2008, 15:24 #6
You mentioned in your OP that the name was copied across but not the description. I can't see a description field in the list item windowclass, but if it is formattedtext then you will probably have some difficulties: I don't think formattedtext fields can be copied - least not that I can discover.
Cheers
Stuart
-
January 16th, 2008, 15:26 #7
Hmmmm...
A secondary question about the description field? Can several values be added to it?
As in the names from Two fields/labels?
-
January 16th, 2008, 15:31 #8Originally Posted by Foen
-
January 16th, 2008, 15:35 #9Originally Posted by joshuha
-
January 16th, 2008, 15:41 #10
.... nor did adding this to the script.
Code:function onDrag(button, x, y, draginfo) draginfo.setDescription(window.getDatabaseNode().getChild("label").getValue()); end
Gee and I am painfully reminded that I am by NO means a competent LUA coder...
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks