PDA

View Full Version : Interesting Coding Issue - Or - What The Hell Am I Doing Wrong



dulux-oz
April 23rd, 2014, 09:00
Hi Guys,

The following line of code is throwing up a Warning.


DB.setValue(oChildNode,"name","string",oDragData.getDescription());


Script Warning: setValue: Recursive node event or call terminated (shop.id-00001.itemlist.id-00031.name)


The above line is part of a onDrop Function, reproduced below:



function onDrop(nXPos,nYPos,oDragData)
if oDragData.getType() == "shortcut" and
oDragData.getShortcutData() == "item" and
not WindowManager.getReadOnlyState(window.getDatabaseN ode()) 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


Any ideas where I'm going wrong or what's causing it - I've missed something and I can't seem to work it out.

Thanks

Cheers

Trenloe
April 23rd, 2014, 13:18
It sounds like the setValue command triggers an onUpdate event whose code uses a setValue command that triggers the onUpdate event again and this could go on-and-on.

dulux-oz
April 23rd, 2014, 13:56
It sounds like the setValue command triggers an onUpdate event whose code uses a setValue command that triggers the onUpdate event again and this could go on-and-on.

Yeap, that was it - not an onUpdate but a onValueChanged on the source Node - that's what I get trying to code when I'm tired.

Thanks Tren