PDA

View Full Version : DragData.setDescription() Help Required



dulux-oz
March 25th, 2014, 08:26
Hi Guys,

Could someone please provide an example of setting the Description (or other elements) of a Dragdata object for a Shortcut item (ie when to call the dragdata.setDescription() function) - I need to set a couple of values so that when I drag an item from a list and drop it onto another list certain values are checked. My onDrop() Code is as follows:


function onDrop(nXPos,nYPos,oDragData)
if oDragData.getType() == "shortcut" and
oDragData.getShortcutData() == "my_value" then
local oChildNode = DB.createChild(getDatabaseNode());
DB.setValue(oChildNode,"name","string",oDragData.getDescription());
DB.setValue(oChildNode,"shortcut","windowreference",oDragData.getShortcutData());
else
return true;
end
end


Thanks guys

Zeus
March 25th, 2014, 10:49
Have a look at the definition of the windowreferencecontrol (https://www.fantasygrounds.com/refdoc/windowreferencecontrol.xcp) (or linkfield template) for the objects your dragging, you can auto-set the description of the link (when dragged) by adding the following tag to the windowreferencecontrol/linkfield definition.


<description control=[name of field/control]>
e.g.

<windowclass name="reference_indexitem">
<margins control="0,0,0,2" />
<sheetdata>
<linkfield name="listlink">
<bounds>5,2,20,20</bounds>
<description control="name" />
<readonly />
</linkfield>
<string_list_link name="name">
<bounds>25,2,-1,20</bounds>
<linktarget>listlink</linktarget>
</string_list_link>
</sheetdata>
</windowclass>

In the example above the description of the linkfield is set to the value of the name control. See the developer reference guide for more information on windowreferencecontrol (https://www.fantasygrounds.com/refdoc/windowreferencecontrol.xcp).

dulux-oz
March 25th, 2014, 11:09
Thanks Zeus - missed it in my read-through :)

What the Developer Documentation needs is a really good search function :p

Cheers