PDA

View Full Version : Restricting update of element from drag



drahkar
May 19th, 2011, 14:42
I'm having an issue where some elements can be updated by drag dropping a string onto them. I know this is normal behavior for FG, but is there a way to disable this? I want it to be able to process Drag and Drops, but I want to make it discard things like string draginfo objects.

Any thoughts?

EDIT: Sorry about that. Typo. Sorcerer is right. Meant string. Corrected.

Zeus
May 19th, 2011, 17:30
I am not sure what you mean when you say ' drag dropping a strong onto them'.

However in general you can override the standard drag/drop behaviour of any window control by defining and overriding the following event functions:


function onDrag( button, x, y, dragdata ) -- Fires when drag starts
function onDragEnd(dragdata) -- Fires when drag ends
function onDrop( button, x, y, dragdata ) -- Fires when something is dropped

Just define a script block within each control you want to customise the onDrop handling for, add your own onDrop() function and your good to go.

More information here (https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#onDrop).

Sorcerer
May 19th, 2011, 17:31
I think he meant to type "string"

drahkar
May 19th, 2011, 17:58
I was actually looking to try and prevent an element from changing when an onDrop was triggered. Ikael made some suggestions on chat about declaring the stringtypes within the onDrop and having the only code within it be a return. I'm going to give that a try and see.

Thanks for the recommendations, Doc.

Moon Wizard
May 20th, 2011, 06:19
There is also a nodrop tag for stringcontrols, which disables the default drop behavior.

https://www.fantasygrounds.com/refdoc/stringcontrol.xcp

Cheers,
JPG