View Single Post
07-13-19, 10:36 PM   #1
thewizard20
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jul 2019
Posts: 2
Question Trouble Showing Icons Inside of Scrolling Frame

I'm still trying to wrap my head around building interfaces and was hoping someone can point me in a direction. I currently have a frame with a scrollbar, and I'm trying to populate rows in that frame with a loop:

Lua Code:
  1. for index=1,GetNumShapeshiftForms(),1 do
  2.         icon, name, active = GetShapeshiftFormInfo(index)
  3.         MyAddOn_BuildStanceListItem(f.ScrollFrame, index, icon, name, active);
  4.     end

Inside my function to build each row, I'm currently attempting to load the texture for each shapeshift form inside my scrolling frame, but I don't seem to get a single icon to appear.

Lua Code:
  1. function MyAddOn_BuildStanceListItem(f, index, icon, name, active)
  2.     print("Building List Item");
  3.     print("Icon: " .. icon);
  4.     local texture = GetSpellTexture(icon);
  5.     print("Texture: " .. texture);
  6.     local ListItem = CreateFrame("Frame", "MyAddOnListItem"..index, f);
  7.     print("Created ListItem");
  8.     ListItem:ClearAllPoints();
  9.     ListItem:SetPoint("TOPLEFT", f);
  10.     ListItem:SetSize(315, 68);
  11.     print("Creating AuraIcon");
  12.     local AuraIcon = CreateFrame("Frame", "StanceIcon"..index, ListItem);
  13.     print("Setting Width");
  14.     AuraIcon:SetWidth(68);
  15.     print("Setting Height");
  16.     AuraIcon:SetHeight(68);
  17.     print("Creating Texture");
  18.     local tg = AuraIcon:CreateTexture(nil, "ARTWORK");
  19.     tg:SetTexture(texture);
  20.     tg:SetSize(68, 68);
  21.     tg:SetPoint("LEFT");
  22.     AuraIcon.texture = tg;
  23. end

I'm floundering trying to figure out if I'm incorrectly loading the textures, dealing with frames in an incorrect way, or both. I don't need anything to happen if the texture is pressed, I just want to use it as artwork inside the scroll frame to accompany a font string. While I may need to consider offsets between indicies, I anticipated at least one icon to appear.
  Reply With Quote