Thread Tools Display Modes
06-29-13, 04:30 PM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Finding the frame under the cursor

Alright, so I'm working on an add-on which has many text boxes, and to keep things simple I'm giving it a drag&drop feature for them. I wanted it to look nice and clear, so I made it so that while dragging, there's a half transparent copy of what you're dragging under the cursor.
The problem: having this frame under the cursor means I don't get OnEnter events while dragging, so I can't know where I'm dropping it.
Is there a way to detect which frame is under the cursor at a given moment out of a set of frames? Is there a way to make the OnEnter events work despite this effect?
  Reply With Quote
06-29-13, 04:40 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Type /fstack, same again to get rid of the frame stack window.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-29-13, 05:04 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
If I read your request right, the info at http://www.wowpedia.org/API_Region_IsMouseOver should point you in the right direction.


Of course it means you have to cycle through the frames you want to check for and can't just check what is under the mouse.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
06-29-13, 05:53 PM   #4
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Xrystal View Post
If I read your request right, the info at http://www.wowpedia.org/API_Region_IsMouseOver should point you in the right direction.


Of course it means you have to cycle through the frames you want to check for and can't just check what is under the mouse.
Since that appears to be a method I can call for each of the relevant frames, and the event is user-driven so not likely to happen a hundred times per second, that's probably what I'll use
  Reply With Quote
07-01-13, 01:56 AM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
GetMouseFocus() should return the frame that is currently receiving mouse events.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-01-13, 02:53 AM   #6
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
GetMouseFocus() would fail for the same reason that I can't get OnEnter events. But IsMouseOver() has been working wonderfully well for me, especially with the offset parameters!
  Reply With Quote
07-01-13, 01:00 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
It should only fail if the frame is not set to receive mouse events (EnableMouse="false"). Note most frames aren't set to receive them by default. I would think the reason an OnEnter event doesn't fire for a frame with mouse events enabled and while dragging is the mouse is still over the frame, not meeting the requirements for it to fire again.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 07-01-13 at 01:03 PM.
  Reply With Quote
07-01-13, 04:30 PM   #8
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
It fails because the frame he's dragging is between the mouse and the frame he's trying to interact with.
  Reply With Quote
07-01-13, 08:53 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
If that's the case, what happens if you turn off mouse handling for a frame you're currently dragging? Although it may not sound like a good idea, it might be something to look into as a possibility if the OnDragStop event still fires.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-02-13, 05:21 AM   #10
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Mouse handling is already off for the frame I'm dragging, the events all belong to other frames. It still gets in the way. But IsMouseOver() really solved it nicely.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Finding the frame under the cursor


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off