Quantcast
Nameplates Target Mouse DOWN - WoWInterface
Thread Tools Display Modes
03-14-17, 08:40 AM   #1
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
Nameplates Target Mouse DOWN

Hello, is there a way to target a unit by mouse down on nameplates ? currently it responds to mouse up event.

Last edited by Taudier : 03-14-17 at 08:49 AM.
  Reply With Quote
03-14-17, 02:22 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,960
Short answer, no.

The nameplates themselves don't actually handle the click events. They're passed through to WorldFrame that does everything in C code. I don't even think a SecureUnitFrameTemplate can be set up to distinguish OnMouseUp and OnMouseDown events since they run their secure code from OnClick.
__________________
ESOUI AddOns | 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 : 03-14-17 at 02:26 PM.
  Reply With Quote
03-14-17, 05:51 PM   #3
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
I put a button over the nameplates to target the mouseover, but it makes them to not respond to the mouseover anymore.

It seems not possible to retrieve the GetText() of the name with the SecureHandlerStateTemplate in a secure way.

nameplateX are not supported by the SecureActionButtonTemplate, and anyway it seems not possible to retrieve them in a secure way.

Overall, i guess it's a dead end.
  Reply With Quote
03-14-17, 06:47 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 429
Haven't tried it, but maybe this works:
Lua Code:
  1. local button = CreateFrame("Button", "MouseoverButton", nil, "SecureHandlerStateTemplate, SecureActionButtonTemplate")
  2.  
  3. button:SetAttribute("type", "target")
  4. button:SetAttribute("unit", "mouseover")
  5. button:RegisterForClicks("AnyDown")
  6.  
  7. RegisterStateDriver(button, "mouseover", "[@mouseover,exists]true;nil")
  8.  
  9. button:SetAttribute("_onstate-mouseover", [[
  10.     if newstate then
  11.         self:SetBindingClick(true, "BUTTON1", self)
  12.     else
  13.         self:ClearBindings()
  14.     end
  15. ]])
__________________

Last edited by MunkDev : 03-14-17 at 07:03 PM.
  Reply With Quote
03-15-17, 03:53 AM   #5
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
The problem is that the area of mouseover is much bigger than the nameplates area.

It is possible to SetBindingClick "OnEnter" a nameplate area, but one frame must be hidden to retrieve the mouseover, which makes it unavailidable for a "OnLeave" event in order to reactivate it. Maybe by creating a frame box arround the nameplates...

thanks for your help

Last edited by Taudier : 03-15-17 at 04:25 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Nameplates Target Mouse DOWN

Thread Tools
Display Modes

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