PDA

View Full Version : Dragging Icons



Nickademus
December 6th, 2016, 20:24
How do you get a genericcontrol or buttoncontrol with an icon to start a drag action? It seems they are off by default. The stringcontrol drags by default but I'd rather not drag strings. The windowreferencecontrol just makes the control disappear...

Moon Wizard
December 6th, 2016, 22:08
There is no default behavior for button and generic control dragging, because they don't have any inherent need for a drag behavior with the simple versions. Only if you add them.

Try something like this:


function onDragStart(button, x, y, draginfo)
local sIcon = "youriconname";

draginfo.setType("shortcut");
draginfo.setIcon("<icon_asset_name>");
draginfo.setShortcutData("<link_class_name>", "<link_path>");
return true;
end


Regards,
JPG

Nickademus
December 6th, 2016, 23:05
Will try this tomorrow. Thank you.