Thread Tools Display Modes
07-31-13, 03:27 PM   #1
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
StatusBar background appears above statusbar

My issue is that my background is appearing above the foreground of my statusbar, here's what I got so far.

Lua Code:
  1. local statusbar = CreateFrame("StatusBar", nil, frame)
  2. statusbar:SetPoint("CENTER", frame, "CENTER", 0, 0)
  3. statusbar:SetWidth(105)
  4. statusbar:SetHeight(19)
  5. statusbar:SetStatusBarTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
  6. statusbar:GetStatusBarTexture():SetHorizTile(false)
  7. statusbar:GetStatusBarTexture():SetVertTile(false)
  8. statusbar:SetStatusBarColor(0.7, 0.70, 0)
  9. statusbar:SetMinMaxValues(0,maxEnergy)
  10. statusbar:SetValue(100)
  11.  
  12. statusbar.bg = statusbar:CreateTexture(nil, "BACKGROUND")
  13. statusbar.bg:SetTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
  14. statusbar.bg:SetAllPoints(true)
  15. statusbar.bg:SetVertexColor(0.2, 0.2, 0)

I've tried alot of things, any help would be great.
  Reply With Quote
07-31-13, 03:39 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Your code works fine.
Lua Code:
  1. local statusbar = CreateFrame("StatusBar", nil, UIParent)
  2. statusbar:SetPoint('CENTER')
  3. statusbar:SetSize(105, 19)
  4. statusbar:SetStatusBarTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
  5. statusbar:SetStatusBarColor(0, 1, 0)
  6. statusbar:SetMinMaxValues(0, 100)
  7. statusbar:SetValue(75)
  8.  
  9. statusbar.bg = statusbar:CreateTexture(nil, "BACKGROUND")
  10. statusbar.bg:SetTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
  11. statusbar.bg:SetAllPoints()
  12. statusbar.bg:SetVertexColor(1, 0, 0)
  Reply With Quote
07-31-13, 04:48 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
As Semlar says, there's nothing in the code you posted that would cause the background texture to appear above the bar texture. Please post your entire code.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-01-13, 01:27 AM   #4
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Ok, I figured it out..

I needed to set min max values after addon loaded otherwise UnitPowerMax returns 0 sometimes

Last edited by Spawnova : 08-01-13 at 01:36 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » StatusBar background appears above statusbar


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off