Hello, I've written my first addon and will publish it as soon as I figure out this one issue.
I started out simple, with a TopLevelControl that contained a Label. The desired display would be the text in the label appearing centered on the screen, just above the reticle. This was easy and direct enough in XML (pretty much straight from the "build your first addon" tutorial):
Things got a little tricky when I wanted to add an icon to the left of the text. In order to get the texture to appear directly to the left of the text, I had to basically left-justify everything and make the anchors for the texture and the text relative to one another, something like:
The problem is, of course now the Icon-Text combination are no longer centered in the screen since it's left justified. And I can't for the life of me figure out the solution to get the Icon-Text control combo to be centered on screen. I've worked with HTML and CSS for a couple of decades but the solution to this simple problem is eluding me.
I've considered shimming the placement of the controls using Lua logic to calculate the position, but that seems ridiculous and there has to be a simple solution using anchors that I'm just not seeing. I've messed with it for several hours at this point and I thought I'd ask the experts.
From the code you posted it looks you are getting the order wrong. You are trying to anchor the texture to the label control, but define the label after the texture. When the game sees the line defining the anchor, FooLabel is nil, so instead it used the parent control SomeTopLevelControl as anchor target.