View Single Post
04-12-13, 05:46 AM   #6
fRodzet
A Flamescale Wyrmkin
Join Date: Mar 2013
Posts: 114
Allright here is my code, but it ain't working.. Doesn't create a button. Sorry - but as of now i'm still not good enough to figure out myself how to get it working, so some more help would be Lovely!

Lua Code:
  1. -------------------
  2. --BagBuddy Frames--
  3. -------------------
  4.  
  5.     -- The parent frame of BagBuddy
  6.     local frame = CreateFrame("Frame", "BagBuddy", UIParent)
  7.     frame:SetSize(425, 425)
  8.     frame:SetPoint("CENTER", UIParent, "CENTER")
  9.  
  10.     -- The Body frame of BagBuddy (the border itself)
  11.     frame.body = frame:CreateTexture("BagBuddy_Body", "BORDER")
  12.     frame.body:SetPoint("TOPLEFT")
  13.     frame.body:SetTexture("Interface\\BankFrame\\UI-BankFrame")
  14.    
  15.     -- Making BagBuddy movable
  16.     frame:EnableMouse(true)
  17.     frame:SetMovable(true)
  18.     frame:SetClampedToScreen(true)
  19.     frame:RegisterForDrag("LeftButton")
  20.     frame:SetScript("OnDragStart", frame.StartMoving)
  21.     frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
  22.  
  23.     -- The icon(portrait) texture of BagBuddy
  24.     frame.icon = frame:CreateTexture("BagBuddy_Icon", "BACKGROUND")
  25.     frame.icon:SetSize(60, 60)
  26.     frame.icon:SetPoint("TOPLEFT", 7, -6)
  27.     frame.icon:SetTexture("Interface\\Icons\\INV_Misc_EngGizmos_17")
  28.     SetPortraitToTexture(frame.icon, "Interface\\Icons\\INV_Misc_EngGizmos_17")
  29.  
  30.     -- The title fontstring of BagBuddy.
  31.     frame.title = frame:CreateFontString("BagBuddy_Title", "OVERLAY", "GameFontNormal")
  32.     frame.title:SetPoint("TOP", 0, -18)
  33.     frame.title:SetText("BagBuddy")
  34.  
  35.     -- The close button for BagBuddy.
  36.     frame.close = CreateFrame("Button", "BagBuddy_Close", frame, "UIPanelCloseButton")
  37.     frame.close:SetPoint("TOPRIGHT", -22, -8)
  38.  
  39. -----------------------
  40. --BagBuddy Loop Items--
  41. -----------------------
  42.  
  43. frame.items = {}
  44. for idx = 1, 28 do
  45.     local item = CreateFrame("Button", "BagBuddy_Item" .. idx, frame, "SecureActionButtonTemplate")
  46.     item:SetSize(37, 37)
  47.    
  48.     item:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
  49.     item:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
  50.     item:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
  51.     do local tex = item:GetNormalTexture()
  52.         tex:ClearAllPoints()
  53.         tex:SetPoint("CENTER", 0, -1)
  54.         tex:SetSize(64, 64)
  55.     end
  56.    
  57.     item.icon = item:CreateTexture("$parentIconTexture", "BORDER")
  58.    
  59.     item.count = item:CreateFontString("$parentCount", "BORDER", "NumberFontNormal")
  60.     item.coun:SetPoint("BOTTOMRIGHT", -5, 2)
  61.     item.count:SetJustifyH("RIGHT")
  62.     item.count:Hide()
  63.    
  64.     item.glow = item:CreateTexture("$parentGlow", "OVERLAY")
  65.     item.glow:SetPoint("CENTER")
  66.     item.glow:SetSize(70, 70)
  67.     item.glow:SetTexture("Interface\\Buttons\\UI-ActionButton-Border")
  68.     item.glow:SetBlendMode("ADD")
  69.     item.glow:SetAlpha(0.6)
  70.    
  71.     frame.items[idx] = item
  72.    
  73.     if idx == 1 then
  74.         item:SetPoint("TOPLEFT", 40, -73)
  75.     elseif idx == 8 or idx == 15 or idx == 22 then
  76.         item:SetPoint("TOPLEFT", frame.items[idx - 7], "BOTTOMLEFT", 0, -7)
  77.     else
  78.         item:SetPoint("TOPLEFT", frame.items[idx - 1], "TOPRIGHT", 12, 0)
  79.     end
  80. end
  81.  
  82.  
  83. ----------------------
  84. --BagBuddy Functions--
  85. ----------------------

I looked it through and doesn't seem like a typing mistake.

Last edited by fRodzet : 04-12-13 at 05:55 AM.
  Reply With Quote