View Single Post
06/13/20, 09:20 AM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
From your code it looks liek it should anchor properly. Bar_Slot_1's topleft to your TLC control's topleft (I assume BarTracker.guiFront is your TLC?) and Bar_Slot_2's topleft to Bar_Slot_1's topright.
Not sure why it does not show then.
Does your template of the slot contain any anchors? I see your code got them commented above maybe you have added them again?
Then always call slot:ClearAnchors() before setting new ones.

You can also try merTorchbug (like zgoo but with more features) as you are easy able to change the hidden state of a control you inspect.
Try /tbug Bar_Slot_1. e.g. and set the hidden state (via right click context menu on this ttaribut) to true and check if you are able to see your Bar_Slot_2 then. Or inspect Bar_Slot_2 and check what the anchor and the left, top values are.

btw: You should directly start to learn to use unique names for your controls, liek starting with your addon name e.g.
Bar_Slot_1 is not very unique and could be reused in other addons as well, so better use something like "MyAddonName_Bar_Slot_1"


And another hint instead of using a fixed child index to get the texture control:
Code:
local tex = slot:GetChild(1)
The texture could also be something else than always child 1!

You can use WINDOW_MANAGER:GetControlByName(parent, suffixOfChild) as well, so it would be
Lua Code:
  1. local tex = WINDOW_MANAGER:GetControlByName(slot, "Tex") --where "Tex" is the suffix of your textureControl in the XML, could be "Image" or "Texture" or "Icon" or whatever you have chosen in your XML or lua to create the control.


Another way to use the child index 1 would be :
Lua Code:
  1. local tex = WINDOW_MANAGER:GetControlByName(slot, 1)

Last edited by Baertram : 06/13/20 at 09:26 AM.
  Reply With Quote