WoWInterface (
-   Lua/XML Help (
-   -   Putting font over a status bar. (

Hartwell 07-01-19 03:55 AM

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.

Fizzlemizz 07-01-19 10:23 AM

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")

Hartwell 07-03-19 02:29 AM

1 Attachment(s)

Originally Posted by Fizzlemizz (Post 332694)
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!

Attachment 9246

All times are GMT -6. The time now is 01:33 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI