WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Any way to make the new 7.0.3 Personal Resource Display unclickable? (https://www.wowinterface.com/forums/showthread.php?t=54126)

sk68 08-05-16 12:36 AM

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.

SDPhantom 08-05-16 03:31 PM

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.

sk68 08-05-16 07:29 PM

Quote:

Originally Posted by SDPhantom (Post 317508)
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.

Quote:

Originally Posted by SDPhantom (Post 317508)
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?

SDPhantom 08-09-16 02:37 PM

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.

semlar 08-11-16 02:11 AM

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.

Vlad 08-12-16 02:20 AM

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.

Ketho 09-04-16 09:24 PM

Just for reference from #wowuidev

http://infobot.rikers.org/%23wowuidev/20160831.html.gz
Quote:

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


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

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