View Full Version : Drag and Drop diefield problem
Foen
July 3rd, 2007, 19:14
I have been using drag and drop with some success: acceptDrop takes a windowclass name and then a list of field parameters. These work fine for
type = string
type = number
type = formattedtext
but when the source type is diefield the drop process passes a nil/null value. Anyone know how to overcome this?
I could use a string field (such as 1d6+1d8) and then parse it to reconstruct the diefield values, but that doesn't sound very neat.
Cheers
Stuart
(Foen)
joshuha
July 3rd, 2007, 19:28
Note sure exactly what issue you are having but I have custom controls that I have been able to accept dragdata from dice fine using something similiar to this:
function onDrop(x,y,dragdata)
print( x .. y .. dragdata.getType());
if dragdata.getType() == "dice" then
die = dragdata.getDieList()[1].type
dieAdd({die});
end
end
return true;
end
This code just takes the first die in the list and calls a custom addDie parameter. This would also work in a diefield to control what gets put in and how though using setDice().
Foen
July 4th, 2007, 06:15
Thanks Joshua, but I'm trying to do something slightly different.
I have built a custom windowclass which provides information about weapons (name, damage, range etc) which I use in a module as part of the ruleset reference material. I'm trying to implement drag and drop from the module to the equipment section of the charsheet, so that players can add a weapon to their inventory easily.
When a weapon is dragged to the charsheet, the stringfield and numberfield values copy across correctly (so the name and range, for example) but the diefield on the charsheet for the weapon is set to null/nil (I use a diefield for the weapon damage).
The attached picture shows the problem.
Cheers
Stuart
(Foen)
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.