For Valikorlia's trading GUI, I'm wanting to implement dragging and dropping. So far, I've gotten dragging down. However, I can't seem to figure out dropping. The "3" is arbitrary; I just copied another NAT's method (which obviously isn't working in this case

).
This is how I'm doing it. First, we have
onRecordSelection(obj), which is just
obj.onSelect(). This triggers
onDragIcon(obj). (I do it this way to prevent a different icon from being selected when dragging the mouse over it.) From there, a GuiShowImgCtrl is created, which is the floating icon that the user's dragging around. The problem I'm having is detecting when the mouse is over TradeOfferScroll.
PHP Code:
function onDragIcon(obj) {
if(this.dragging) {
return;
}
new GuiShowImgCtrl("TradeInventoryFloater") {
this.width = 32;
this.height = 32;
System.parseimage(this, staticdata.tradeitems[(@ obj).itemid].icon);
this.x = mousescreenx;
this.y = mousescreeny;
}
setTimer(0.05);
}
PHP Code:
function onTimeout() {
if(leftmousebuttonglobal) {
with(TradeInventoryFloater) {
this.x = mousescreenx;
this.y = mousescreeny;
}
this.dragging = true;
setTimer(0.05);
}
else {
if(mousescreenx in |TradeOfferScroll.x, TradeOfferScroll.x + 3|) {
if(mousescreeny in |TradeOfferScroll.y, TradeOfferScroll.y + 3|) {
echo("Added to offer");
}
}
else {
echo("Destroyed");
}
this.dragging = false;
System.destroyobject("TradeInventoryFloater");
setTimer(0);
}
}
Another NAT on Valikorlia suggested using
showimg() instead of a GuiShowImgCtrl. Is there any benefit with doing this, as opposed to using a GUI control?