WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Drag an item to my frame (https://www.wowinterface.com/forums/showthread.php?t=59727)

dragonflyy 12-03-23 09:43 PM

Drag an item to my frame
 
So I found this older post giving an example of how to drag a spell/item to a frame. However, when I try this is doesn't work.

https://www.wowinterface.com/forums/...ad.php?t=57561


Lua Code:
  1. if(testframe == nil) then --This is built in an in game editor, using check for nil so I don't create multiple frames.
  2.    testframe = CreateFrame("Frame", "aframe", UIParent, "ButtonFrameTemplate")
  3.    
  4.    ButtonFrameTemplate_HidePortrait(testframe)
  5.    ButtonFrameTemplate_HideButtonBar(testframe)
  6.    
  7.    testframe:SetTitle("Drop")
  8.    testframe:SetSize(100,100)
  9.    testframe:SetPoint("LEFT", 100, 0)
  10. end
  11.  
  12. testframe:SetScript("OnMouseUp", function (self, button)
  13.       print(GetCursorInfo())
  14. end)

So what does happen is I grab an item and drag it to the frame while still holding the mouse down. When I release, nothing happens. If I then click and release with the item still on my mouse pointer, it then fires the onmouseup script. How would I register the mouseup when the mousedown didn't happen on that frame?

Xrystal 12-04-23 03:35 AM

You probably want to use OnReceiveDrag
https://warcraft.wiki.gg/wiki/UIHANDLER_OnReceiveDrag

dragonflyy 12-04-23 02:10 PM

Thank you, that's exactly what I needed.


All times are GMT -6. The time now is 06:02 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI