Thread Tools Display Modes
09-13-12, 12:30 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Statusbar is overlapping :(

So for some reason my statusbar is overlapping my text and I can't figure out why.

All the frame stratas / levels are correct.

Lua Code:
  1. function SimplePowerBar:CreatePowerBar()
  2.     db = self.db.profile
  3.    
  4.     spb = CreateFrame("Frame", "SPB_APB", UIParent)
  5.    
  6.     spb:SetBackdrop({
  7.         bgFile = db.PanelTex,
  8.         edgeFile = db.PanelTex,
  9.         tile = false, tileSize = 0, edgeSize = db.borderSize,
  10.         insets = { left = db.borderInset, right = db.borderInset, top = db.borderInset, bottom = db.borderInset}
  11.     }) 
  12.     spb:SetHeight(db.height)
  13.     spb:SetWidth(db.width)
  14.     spb:SetPoint("CENTER",UIParent,"CENTER", db.x, db.y)
  15.    
  16.     spb:SetFrameStrata(db.frameStrata)
  17.     spb:SetFrameLevel(db.frameLevel)
  18.    
  19.     spb:SetMovable(true)
  20.     spb:SetClampedToScreen(true)
  21.     spb:SetUserPlaced(true)
  22.    
  23.     spb.lock = spb:CreateTexture(nil,"OVERLAY")
  24.     spb.lock:SetTexture("Interface\\GLUES\\CharacterSelect\\Glues-AddOn-Icons")
  25.     spb.lock:SetWidth(8)
  26.     spb.lock:SetHeight(8)
  27.     spb.lock:SetTexCoord(0.25,0.48,0,1)
  28.     spb.lock:SetAlpha(1)
  29.     spb.lock:SetPoint("CENTER", spb, "TOPRIGHT")
  30.    
  31.     spb.power = spb:CreateFontString(nil, "OVERLAY")
  32.     spb.label = spb:CreateFontString(nil, "OVERLAY")
  33.    
  34.     spb.bar = CreateFrame("StatusBar", nil, spb)
  35.     spb.bar:SetPoint("TOPLEFT", spb, "TOPLEFT", 1, -1)
  36.     spb.bar:SetPoint("BOTTOMRIGHT", spb, "BOTTOMRIGHT", -1, 1)
  37.     spb.bar:SetFrameStrata(spb:GetFrameStrata())
  38.     spb.bar:SetFrameLevel(spb:GetFrameLevel()+1)
  39.  
  40. end


Just for reference, lines 15 / 16 set to "MEDIUM" and "1" and 37/38 set "MEDIUM" and "2".

Last edited by suicidalkatt : 09-13-12 at 12:35 AM.
  Reply With Quote
09-13-12, 01:54 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, you never set any points for your font strings, so I wouldn't expect them to show up anywhere at all.

Other than that, nothing jumps out at me. Screenshot of the overlapping issue? Full code so we can load it in-game?
__________________
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
09-13-12, 02:00 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I had tons of these problems with overlapping textures until I found out that the best way to get around it is to stack frames ontop of each other. You do not have to care of the framelevel or strata in most cases. The order in which you create the frames is sufficient.

For statusbars I mostly use sth like this (but I'm texture heavy...)
1) "bar" layer ... frame of type FRAME with the background textures for the bar, parented to UIParent
2) "statusbar" layer frame of type STATUSBAR with statusbar textures and statusbar background, parented to bar
3) "gloss" layer of type FRAME with every highlight texture I may need + fontstrings, parented to statusbar

This would look like
Code:
local bar = CreateFrame("Frame", nil, UIParent)
local statusbar = CreateFrame("Statusbar", nil, bar)
local gloss = CreateFrame("Frame", nil, statusbar)
Textures on a specific layer can be stacked very easily via:
Code:
local t = bar:CreateTexture(nil,"BACKGROUND",nil,-8)
"BACKGROUND" is always sufficient since you can have texture levels from -8 to sth like 4. That is more that enough.

If you cannot do frame stacking another solution is to do sth like this:
Code:
gloss:SetFrameLevel(max(frame1:GetFrameLevel()+1,frame2:GetFrameLevel()+1))
But normally frame stacking is sufficient.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-13-12 at 02:02 AM.
  Reply With Quote
09-13-12, 03:23 AM   #4
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Phanx View Post
Well, you never set any points for your font strings, so I wouldn't expect them to show up anywhere at all.

Other than that, nothing jumps out at me. Screenshot of the overlapping issue? Full code so we can load it in-game?
They're set at a later point. The issue was simply that my framestrata adjust basically isn't needed. Zork cleared that up.
  Reply With Quote
09-13-12, 10:12 AM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Code:
spb.bar:SetFrameStrata(spb:GetFrameStrata())
spb.bar:SetFrameLevel(spb:GetFrameLevel()+1)
These are already at their default values, the FrameStrata equal to parent and FrameLevel is parent +1. The problem is at +1 or above, it will always draw OVER the parent including all of the parent's drawlayers. If you need this to happen, but still have the text over the bar, I'd suggest parenting the text to the bar in this block of code.

Code:
spb.bar = CreateFrame("StatusBar", nil, spb)
spb.bar:SetPoint("TOPLEFT", spb, "TOPLEFT", 1, -1)
spb.bar:SetPoint("BOTTOMRIGHT", spb, "BOTTOMRIGHT", -1, 1)

spb.power = spb.bar:CreateFontString(nil, "OVERLAY")
spb.label = spb.bar:CreateFontString(nil, "OVERLAY")
Notice this doesn't change what key the object pointer is stored in, just what parent the FontStrings are created on.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 09-13-12 at 10:16 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Statusbar is overlapping :(


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