Frame is not linked to its parent

Status
Not open for further replies.
The XPBarRaces simpleframes are not created as child frames to the progressionMenu for some reason, and it seems like it's not created on the ORIGIN_FRAME_GAME_UI either when printing the parents of both the progressionMenu and XPBarRaces[1]. Can someone help?

frame.PNG

Lua:
progressionMenu = BlzCreateFrame("EscMenuBackdrop", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
BlzFrameSetSize(progressionMenu, 0.25, 0.34)
BlzFrameSetAbsPoint(progressionMenu, FRAMEPOINT_CENTER, 0.2, 0.36)
BlzFrameSetVisible(progressionMenu, false)

frameSkinsText = BlzCreateFrameByType("BACKDROP", "", progressionMenu, "", 0)
BlzFrameSetSize(frameSkinsText, 0.166, 0.057)
BlzFrameSetAbsPoint(frameSkinsText, FRAMEPOINT_CENTER, 0.2, 0.49)
BlzFrameSetTexture(frameSkinsText, "war3mapImported\\Progression.tga", 0, true)

XPBarRaces = {}
local raceNames = {}
raceNames[1] = "Human"
raceNames[2] = "Orc"
raceNames[3] = "Undead"
raceNames[4] = "Night Elf"

local yPos = 0
for i = 1, 4 do
    XPBarRaces[i] = BlzCreateSimpleFrame("MyStatusBarBordered", progressionMenu, i)
    BlzFrameSetAbsPoint(XPBarRaces[i], FRAMEPOINT_CENTER, 0.15, 0.5 - yPos)
    BlzFrameSetSize(XPBarRaces[i], 0.12, 0.01)
    BlzFrameSetText(BlzGetFrameByName("MyStatusBarText", i), raceNames[i] .. "    -    Level 1")
    BlzFrameSetTexture(XPBarRaces[i], "Replaceabletextures\\Teamcolor\\Teamcolor03.blp", 0, true) -- Use values 00 to 27 for different colors
    BlzFrameSetValue(XPBarRaces[i], 50)

    yPos = yPos + 0.012
end
 
Replacing the simpleframe with the below code makes it invisible:

Lua:
XPBarRaces[i] = BlzCreateFrameByType("MyStatusBarBordered", "", progressionMenu, "", i)

It's still created since I can print its parent frame, but this time I tried to print the parent of the "frameSkinsText" as well "XPBarRaces" (both use the same function) and I still get a different parent frame.

I also tried to create it with BlzCreateFrame, but that crashes the script.
 
Lua:
XPBarRaces[i] = BlzCreateFrameByType("MyStatusBarBordered", "", progressionMenu, "", i)

I just realised the .fdf uses a simpleframe.

FDF:
Code:
// -- INCLUDE FILES ---------------------------------------------------------

IncludeFile "UI\FrameDef\UI\replaypanel.fdf",

// -- LOCAL TEMPLATES -------------------------------------------------------
Frame "SIMPLESTATUSBAR" "MyStatusBarBordered" {
   DecorateFileNames,
   Width 0.158,
   Height 0.012,
   BarTexture "SimpleBuildTimeIndicator",
   //BarTexture "SimpleHpBarConsole",
   //BarTexture "SimpleXpBarConsole",
   Frame "SIMPLEFRAME" "MyStatusBarBorder" {
       SetAllPoints,
       DecorateFileNames,

       Layer "ARTWORK" {
           Texture {
               //File "SimpleBuildTimeIndicatorBorder",
               File "SimpleXpBarBorder",
           }
           String "MyStatusBarText" INHERITS "ReplayPanelStringTemplate" {
               //FontJustificationH JUSTIFYLEFT,
               Text "Text",
           }

       }
   }
}

Frame "SIMPLESTATUSBAR" "MySimpleBar" {
   //No Border, no default Texture, no overlay Text
   Width 0.158,
   Height 0.012,
}
 
Level 10
Joined
Mar 26, 2017
Messages
376
Seems like there is only the simple variant of the statusbar.

You could instead of making a statusbar, use backdrop frames and stretch the 'fill' backdrop accordingly. Though this is fairly tedious.

If for the purpose of controlling the visibility with the parent 'progressionMenu', you might just add lines of BlzFrameSetVisible...XPBarRaces to get the desired behaviour, whereever you would toggle visibility of the progression menu.
 
Level 15
Joined
Feb 7, 2020
Messages
398
Simpleframes cannot be children of non-simple frames.

The differing framehandle issue is reiterated here: UI - The concept of Parent-Frames

I haven't found a way to use parents with simpleframes, so I opt to make my own parent table and run loops on them with helper functions when the "parent" is hidden, shown, etc.

Also, progress bars are wonky. I have experienced strange issues with the texture layers competing for layer position. To get around this, I make sure any stacking of frames with bars uses simpleframes for everything. You'll have to let us know if you find a workaround. You could use a background fill layer and manually set the width, for example.
 
Well I've reached a point where I don't want to research too much about simpleframes and all the rest of it, so I ended up doing everything manually.
I took a screenshot of a progress bar, went into Photoshop to fix the dimensions and alpha channels and imported it as an image. I then made these small images: Bar Human.png Bar Orc.png Bar Undead.png Bar Night Elf.png which I use as the bar fill. So now I can create them as normal frames and have full control over their parent frames and whatnot.

Bars.PNG


Lua:
    XPBarRaces = {}
    XPBarFill = {}
    XPBarRaceText = {}

    local tempTex = {}
    tempTex[1] = "war3mapImported\\Bar Human.tga"
    tempTex[2] = "war3mapImported\\Bar Orc.tga"
    tempTex[3] = "war3mapImported\\Bar Undead.tga"
    tempTex[4] = "war3mapImported\\Bar Night Elf.tga"

    local tempText = {}
    tempText[1] = "Human - Level 1"
    tempText[2] = "Orc - Level 1"
    tempText[3] = "Undead - Level 1"
    tempText[4] = "Night Elf - Level 1"

    local yPos = 0
    for i = 1, 4 do
        XPBarRaces[i] = BlzCreateFrameByType("BACKDROP", "", progressionMenu, "", 0)
        BlzFrameSetSize(XPBarRaces[i], 0.1, 0.015)
        BlzFrameSetAbsPoint(XPBarRaces[i], FRAMEPOINT_LEFT, 0.1, 0.41 - yPos)
        BlzFrameSetTexture(XPBarRaces[i], "war3mapImported\\bar.tga", 0, true)
        BlzFrameSetLevel(XPBarRaces[i], 1)

        XPBarFill[i] = BlzCreateFrameByType("BACKDROP", "", progressionMenu, "", 0)
        BlzFrameSetSize(XPBarFill[i], 0.033, 0.013)
        BlzFrameSetAbsPoint(XPBarFill[i], FRAMEPOINT_LEFT, 0.1, 0.41 - yPos)
        BlzFrameSetTexture(XPBarFill[i], tempTex[i], 0, true)

        XPBarRaceText[i] = BlzCreateFrameByType("TEXT", "text", progressionMenu, "EscMenuButtonTextTemplate", 0)
        BlzFrameSetAbsPoint(XPBarRaceText[i], FRAMEPOINT_CENTER, 0.15, 0.41 - yPos)
        BlzFrameSetText(XPBarRaceText[i], tempText[i])

        yPos = yPos + 0.018
    end
 
Last edited:
Status
Not open for further replies.
Top