Quantcast
Is it possible to edit font of Cooldown frame that uses "CooldownFrameTemplate"? - WoWInterface
Thread Tools Display Modes
07-31-16, 12:20 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Is it possible to edit font of Cooldown frame that uses "CooldownFrameTemplate"?

Hi all,

I was trying to edit font type and height of a Cooldown frame that utilizes "CooldownFrameTemplate".

Lua Code:
  1. local cd = CreateFrame("Cooldown", "$parentCoolDown", button, "CooldownFrameTemplate");
  2. cd:SetAllPoints(true);

However, I could have not figure it out how I would access to a text...

Could I please get some help regarding this?

Thank you.
  Reply With Quote
07-31-16, 12:46 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
lua Code:
  1. local text = cd:GetRegions()
  2. cd.text = text -- for easier access later
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
07-31-16, 12:49 AM   #3
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Originally Posted by Phanx View Post
lua Code:
  1. local text = cd:GetRegions()
  2. cd.text = text -- for easier access later
OMG! Thank you so much
  Reply With Quote
07-31-16, 02:22 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,924
I don't know if they changed this, but be aware the C code has been known to revert the settings on the built-in FontStrings on CooldownFrames every rendering pass.
__________________
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)
  Reply With Quote
07-31-16, 04:22 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I'm currently updating my oUF layout, and did something like this just to be safe:

Code:
local timer = cooldown:GetRegions()

timer:SetFontObject(GameFontHighlightSmall)
timer.SetFontObject = nop
timer.SetFont = nop

timer:ClearAllPoints()
timer.ClearAllPoints = nop

timer:SetPoint("CENTER", button, "TOP", 0, 0)
timer.SetPoint = nop
In limited testing I haven't seen anything reset. (nop is a "do nothing" function defined somewhere in Blizzard code.) I don't even know if the overrides are needed for the default cooldown text; I just reused the code I was previously using to manhandle OmniCC's timer text. If it doesn't actually reset, I'd just leave it alone.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
08-01-16, 02:39 AM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,924
I ran into it a long time ago when they first integrated it into the CooldownFrame. I was trying to change the color and reformat the text and neither worked. Even attempting to replace the SetText(), SetFormattedText(), and SetTextColor() proved to be futile. I think setting the font, size, and position were the only things I was able to do.
__________________
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)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is it possible to edit font of Cooldown frame that uses "CooldownFrameTemplate"?

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