Thread Tools Display Modes
08-30-11, 08:39 AM   #1
Malakahh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 30
Statusbar borders

Hello =)

I'm currently playing around with some status bars, and I've been having some trouble fitting the border textures. As far as I've been able to google myself to, I need to use the SetBackdrop() method, however this places the borders behind my status bar and after even further investigation, I still haven't been able to get them placed in a proper position. I've included an image to clarify what I'm talking about.

Code:
local time = 0
local value = 30
local totalValue = 100

MyStatusBar = CreateFrame("StatusBar", nil, UIParent)
MyStatusBar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
MyStatusBar:GetStatusBarTexture():SetHorizTile(false)
MyStatusBar:SetMinMaxValues(0, 100)
MyStatusBar:SetValue(totalValue)
MyStatusBar:SetWidth(200)
MyStatusBar:SetHeight(10)
MyStatusBar:SetPoint("CENTER",UIParent,"CENTER")
MyStatusBar:SetStatusBarColor(1,0,0)   
   

MyStatusBar:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
                                            edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
                                            tile = true, tileSize = 32, edgeSize = 8, 
                                            insets = { left = 2, right = 2, top = 2, bottom = 2 }
                                            })
MyStatusBar:SetBackdropColor(0,0,0,1)



SLASH_MSB1 = "/msb"
SlashCmdList["MSB"] = function()
  MyStatusBar:SetScript("OnUpdate", function(self, elapsed)
     time = time + elapsed
     local percent = (value-time)/value
     MyStatusBar:SetValue(totalValue*percent)
     print("hi "..time)
  end)
end

SLASH_MSBSTOP1 = "/msb_stop"
SlashCmdList["MSBSTOP"] = function()
   MyStatusBar:SetScript("OnUpdate", nil)
end
Click image for larger version

Name:	Statusbar Wrong.PNG
Views:	303
Size:	9.6 KB
ID:	6469
  Reply With Quote
08-30-11, 08:54 AM   #2
Unkn
Premium Member
 
Unkn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 258
Try changing the insets...

lua Code:
  1. insets = { left = 2, right = 2, top = 2, bottom = 2 }


Play with those values, until you get the border positioned where you wont... you can also do negative numbers for the inset as well. That will move the border out from its anchored position - or making it larger than the bg its attached to - Which might be what you need to do.

Example:
lua Code:
  1. insets = { left = -2, right = -2, top = -2, bottom = -2 }
__________________
"I'm very feminine. And I'll beat the crap out of ANYONE who disagrees!"
  Reply With Quote
08-30-11, 08:59 AM   #3
Malakahh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 30
Thanks for your answer. I just tried entering an exaggerated amount. It only appears to affect the background texture, the edgetexture stay where it is. =/
  Reply With Quote
08-30-11, 11:54 PM   #4
Unkn
Premium Member
 
Unkn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 258
Hrm I'll play with my crappy oUF layout tomorrow see if I can come up with something else to help you. If you figure it out before then YAY!
__________________
"I'm very feminine. And I'll beat the crap out of ANYONE who disagrees!"

Last edited by Unkn : 08-30-11 at 11:54 PM. Reason: typoooooooo
  Reply With Quote
08-31-11, 01:42 AM   #5
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
I'm fairly certain that you can't use regular backdrop borders on status bars because a status bar texture covers the entire frame, and a backdrop cannot be larger than its parent. So, you have to use a separate frame or texture.
  Reply With Quote
08-31-11, 06:02 AM   #6
Malakahh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 30
Originally Posted by Haleth View Post
I'm fairly certain that you can't use regular backdrop borders on status bars because a status bar texture covers the entire frame, and a backdrop cannot be larger than its parent. So, you have to use a separate frame or texture.
Alright, I'll try it when I get home. Thanks a bunch! =)
  Reply With Quote
08-31-11, 07:55 AM   #7
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
Code:
frame.border = CreateFrame("Frame", nil, MyStatusBar)
frame.border:SetPoint("TOPLEFT", MyStatusBar, "TOPLEFT", -2, 2)
frame.border:SetPoint("BOTTOMRIGHT", MyStatusBar, "BOTTOMRIGHT", 2, -2)
frame.border:SetBackdrop({
bgFile = YOUR_TEXTURE, 
edgeFile = YOUR_TEXTURE, 
tile = false, tileSize = 0, edgeSize = 1, 
insets = { left = -1, right = -1, top = -1, bottom = -1}
})
frame.border:SetFrameLevel(MyStatusBar:GetFrameLevel())
__________________
Hi!
  Reply With Quote
08-31-11, 10:25 AM   #8
Malakahh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 30
I copied the code from Sniffles and made the proper adjustments and now it works flawlessly. =)

Thanks for the help!
  Reply With Quote
08-31-11, 10:58 AM   #9
Unkn
Premium Member
 
Unkn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 258
Yay! Glad you got it working.
__________________
"I'm very feminine. And I'll beat the crap out of ANYONE who disagrees!"
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Statusbar borders

Thread Tools
Display Modes

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