Thread Tools Display Modes
08-05-16, 12:36 AM   #1
sk68
A Defias Bandit
Join Date: Dec 2011
Posts: 2
Any way to make the new 7.0.3 Personal Resource Display unclickable?

Hi,

I've been trying to get the Personal Resource Display to become unclickable. So far I've tried the following:

Lua Code:
  1. local function func(frame, setupOptions, frameOptions)
  2.     local unit = frame.displayedUnit or "player"
  3.     if not UnitIsUnit(unit, "player") then return end
  4.  
  5.     print(frame:HasScript("OnClick")) -- returns true
  6.     print(frame:IsProtected()) -- returns false
  7.     frame:Disable()
  8.     frame:EnableMouse(false)
  9.     frame:SetScript("OnClick", function() print("onclick1") end) -- just for testing purposes
  10.     frame:SetScript("OnEnter", function() print("onenter1") end) -- just for testing purposes
  11. end
  12.  
  13. hooksecurefunc("DefaultCompactNamePlateFrameSetupInternal", func)

if I comment out

Lua Code:
  1. frame:Disable()
  2. frame:EnableMouse(false)

then the program prints "onenter1" when the mouse enters the Personal Resource Display and strangely also when I click on it (without moving the mouse). It never prints "onclick1" btw. If I keep the aforementioned two lines uncommented, then the program does not print either "onenter1" or "onclick" but still maintains mouse interactivity, i.e. I can click on it and it will select my toon. So basically I'm stuck atm.

Any help would be appreciated, thank you.

Last edited by sk68 : 08-05-16 at 12:40 AM.
  Reply With Quote
08-05-16, 03:31 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Frame:HasScript() checks if the frame is capable of running the specified script handler. You need to run Frame:GetScript() to see if one is set.

PS: From what I can tell, the personal resource display is essentially a NamePlate dedicated for the player. As such, the NamePlate itself is probably handling the clicks and not the CompactUnitFrame that's built on top of it.
__________________
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 : 08-05-16 at 03:48 PM.
  Reply With Quote
08-05-16, 07:29 PM   #3
sk68
A Defias Bandit
Join Date: Dec 2011
Posts: 2
Originally Posted by SDPhantom View Post
Frame:HasScript() checks if the frame is capable of running the specified script handler. You need to run Frame:GetScript() to see if one is set.
Yeah I wanted to know if the frame is capable of running the OnClick handler. I don't care if it has any set already.

Originally Posted by SDPhantom View Post
PS: From what I can tell, the personal resource display is essentially a NamePlate dedicated for the player. As such, the NamePlate itself is probably handling the clicks and not the CompactUnitFrame that's built on top of it.
Yup I already suspected this to be the case. The question still stands tho. How to disable the personal resource display clickability?

Last edited by sk68 : 08-05-16 at 08:31 PM.
  Reply With Quote
08-09-16, 02:37 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
The base NamePlate is a protected frame. Most of the time when it appears is when the player enters combat and is already in "combat lockdown" in which it cannot be modified. There's no way to disable it the moment it's created, causing the requested functionality to be unreliable.
__________________
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
08-11-16, 02:11 AM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
C_NamePlate.SetNamePlateSelfSize(width, height) controls the size of the resource frame. Setting the height to a small number like 0.01 should make it unclickable, although I'm not sure what impact it will have on the stuff anchored to it.
  Reply With Quote
08-12-16, 02:20 AM   #6
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Doing that will also mind you, adjust the location of it and make it anchor 50px or something more up than it usually is, but I guess that's the price to pay to make it unclickable with this trick.
__________________
Profile: Curse | Wowhead
  Reply With Quote
09-04-16, 09:24 PM   #7
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Just for reference from #wowuidev

http://infobot.rikers.org/%23wowuidev/20160831.html.gz
Aug 31 19:02:55 <TheDanW> API requests that have been approved and implemented for 7.1, with standard caveats about removal if exploits are found etc
Aug 31 19:03:00 <TheDanW> C_NamePlate.SetNamePlateOtherSize is replaced by SetNamePlateFriendlySize and SetNamePlateEnemySize, the self size is the same as before
Aug 31 19:03:10 <TheDanW> added C_NamePlate.SetNamePlateSelfClickThrough, C_NamePlate.SetNamePlateFriendlyClickThrough, C_NamePlate.SetNamePlateEnemyClickThrough and respective getters
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Any way to make the new 7.0.3 Personal Resource Display unclickable?

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