Putting font over a status bar. - WoWInterface
Thread Tools Display Modes
07-01-19, 03:55 AM   #1
A Defias Bandit
Join Date: Jun 2019
Posts: 2
Question Putting font over a status bar.

Hello! I'm not very familiar with LUA or WoW's syntax myself, as I'm quite new to working with it. Right now I'm working with a status bar template and fonts that should go in front of those status bars, as well as messing around with textures. I've bumped into a layering problem, where the textures from the status bar are taking priority over the font.

	-- Create the display frame.
	local UI_DisplayFrame = CreateFrame("Frame", AddonName .. "_PlayerButton_DisplayFrame", UI_Frame);

	-- Set display frame.
	UI_DisplayFrame:SetSize(tableOfPlayerFrame.buttonSize.x, tableOfPlayerFrame.buttonSize.y);
	UI_DisplayFrame:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_Frame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);

	-- Set the health status bar.
	UI_DisplayFrame.statusBar_Health = CreateFrame("StatusBar", AddonName .. "_PlayerButton_DisplayFrame_HealthBar", UI_DisplayFrame, "UIWidgetTemplateStatusBar");
	UI_DisplayFrame.statusBar_Health:SetSize(tableOfPlayerFrame.buttonSize.x, tableOfPlayerFrame.buttonSize.y);
	UI_DisplayFrame.statusBar_Health:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);
	UI_DisplayFrame.statusBar_Health:SetStatusBarTexture("interface/targetingframe/ui-statusbar.blp", "BACKGROUND");
	UI_DisplayFrame.statusBar_Health:SetStatusBarColor(0.2, 1, 0.2);
	UI_DisplayFrame.statusBar_Health:SetMinMaxValues(0, 1);

	-- Make the border to the health status bar.
	UI_DisplayFrame.statusBar_Health.border = UI_DisplayFrame.statusBar_Health:CreateTexture("healthBarBorder", "BORDER");

	-- Make a frame for the text.
	UI_DisplayFrame.textFrame = CreateFrame("Frame", "TextFrame", UI_DisplayFrame.statusBar_Health);

	-- Set the title font.
	UI_DisplayFrame.textFrame.title = UI_DisplayFrame:CreateFontString("buttonTitle", "OVERLAY");
	UI_DisplayFrame.textFrame.title:SetTextColor(0.95, 0.95, 0.95, 0.95);
	UI_DisplayFrame.textFrame.title:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame.textFrame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);

	-- Set the subtitle font.
	UI_DisplayFrame.textFrame.subtitle = UI_DisplayFrame:CreateFontString("buttonSubtitle", "OVERLAY");
	UI_DisplayFrame.textFrame.subtitle:SetTextColor(0.75, 0.75, 0.75, 0.9);
	UI_DisplayFrame.textFrame.subtitle:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame.textFrame.title, tableOfPlayerFrame.buttonRelativeAlignment, 0, -10);
I tried to parent the frames to make the text frame a child of the healthbar. Another thing I've tried to change was the layer of the font as well as changing the category of the layer, but read somewhere that the font should always have the highest layer of a category. I'm not sure if that information is accurate, although I would imagine it to be true. Does the status bar widget template I'm using have something like that going on as well?

Sorry if I don't respond quickly or at all. I'm working a lot of overtime at a job right now. Any advice would be much appreciated for when I have the time.
  Reply With Quote
07-01-19, 10:23 AM   #2
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,230
Instead of using the base parent frame of the addon to create your FontStrings, use the frame that will be the parent (frame you want the text to overlay) of the FontString itself.

UI_DisplayFrame.textFrame.title = UI_DisplayFrame:CreateFontString("buttonTitle", "OVERLAY");
UI_DisplayFrame.textFrame.title = UI_DisplayFrame.textFrame:CreateFontString("buttonTitle", "OVERLAY")
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-01-19 at 10:41 AM.
  Reply With Quote
07-03-19, 02:29 AM   #3
A Defias Bandit
Join Date: Jun 2019
Posts: 2
Originally Posted by Fizzlemizz View Post
Instead of using the base parent frame of the addon to create your FontStrings, use the frame that will be the parent (frame you want the text to overlay) of the FontString itself.

I've made the display frame into the status bar and made the font children of it, which works as you've stated. Thank you! I thought that I could order the child frames of the parent using some sort of index number, but I suppose that is irrelevant anyways if the health bar is pretty much the whole button. On towards learning other stuff!

Click image for larger version

Name:	currentProgress.png
Views:	163
Size:	102.0 KB
ID:	9246
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Putting font over a status bar.

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