Quantcast
WoWInterface - View Single Post - Classicon help
Thread: Classicon help
View Single Post
03-04-15, 12:26 AM   #4
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 581
Originally Posted by Phanx View Post
The problem with your current code is that you're trying to add a border to the whole ClassIcons object -- which is fine, except that that object is just a table, rather than a frame, so it doesn't have the necessary methods.

If you want one border around the whole set of icons, make ClassIcons a frame:
Code:
local numIcons = 5
local iconSpacing = 1
local iconWidth = (cfg.player.width - (iconSpacing * (numIcons - 1)) / numIcons
local iconHeight = cfg.player.height / 4

local ClassIcons = CreateFrame("Frame", nil, self)
ClassIcons:SetSize(cfg.player.width, iconHeight)
ClassIcons:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT")

for index = 1, numIcons do
  local Icon = self:CreateTexture(nil, "BACKGROUND")
  Icon:SetTexture(cfg.statusbar_texture)
  Icon:SetSize(iconWidth, iconHeight)
  if index > 1 then
    Icon:SetPoint("LEFT", ClassIcons[index-1], "RIGHT", iconSpacing, 0)
  else
    Icon:SetPoint("LEFT", ClassIcons)
  end
  ClassIcons[index] = Icon
end

if isBeautiful then -- !Beautycase load check
  ClassIcons:CreateBeautyBorder(12)
  ClassIcons:SetBeautyBorderPadding(1)
end

self.ClassIcons = ClassIcons
If you want individual borders on each icon, make each icon a frame:
Code:
local numIcons = 5
local iconSpacing = 5 -- need wider spacing
local iconWidth = (cfg.player.width - (iconSpacing * (numIcons - 1)) / numIcons
local iconHeight = cfg.player.height / 4

local ClassIcons = {}

for index = 1, numIcons do
  local Icon = CreateFrame("Button", nil, self)
  Icon:SetNormalTexture(cfg.statusbar_texture)
  Icon:GetNormalTexture():SetAllPoints(true)
  Icon:SetSize(iconWidth, iconHeight)
  if index > 1 then
    Icon:SetPoint("LEFT", ClassIcons[index-1], "RIGHT", iconSpacing, 0)
  else
    Icon:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT")
  end
  if isBeautiful then -- !Beautycase load check
    Icon:CreateBeautyBorder(12)
    Icon:SetBeautyBorderPadding(1)
  end
  ClassIcons[index] = Icon
end

self.ClassIcons = ClassIcons
Oh, that's makes sense now.
__________________
Tweets YouTube Website
  Reply With Quote