Thread Tools Display Modes
02-01-11, 03:28 AM   #1
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Help with SetBackdrop?

I've never quite used SetBackdrop before, and typically just use CreateTexture if I'm making a background frame from scratch. I've looked through several different sources (WPanels, WoWPedia, WoWProgramming), to see how it's done, and this looks about right, but the frame doesn't even load.

If I replace the whole SetBackdrop() part with CreateTexture, it shows perfectly where I've placed it.


Code:
local cht = CreateFrame("Frame", "ChatBGFrame", UIParent)
cht:SetFrameLevel(1)
cht:SetHeight(64)
cht:SetWidth(128)
cht:SetFrameStrata("BACKGROUND")
cht:SetPoint("CENTER")
cht:SetBackdrop({
    bgFile = bg, 
    edgeFile = border, 
    tile = false, tileSize = 0, edgeSize = edgesize, 
    insets = { left = 2, right = 2, top = 4, bottom = 4 }
})
cht:SetBackdropColor(setcolor(backdrop))
cht:SetBackdropBorderColor(setcolor(bordercolor))
cht:SetAlpha(1)
end
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote
02-01-11, 03:52 AM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Care to post the full thing? As in, what 'bg', 'border' and 'setcolor' etc is.
  Reply With Quote
02-01-11, 05:14 AM   #3
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Code:
-- Config
edgesize = 12
inset = -1
border = [[Interface\AddOns\desdinPanels\media\border\Roth.tga]]
bg = [[Interface\AddOns\desdinPanels\media\backdrop\Cabaret.tga]]
backdrop = {1, 1, 1}
bordercolor = {1, 1, 1}
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote
02-01-11, 06:29 AM   #4
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Have you defined 'setcolor'? Because that's not a default function.

That's where the problem lies, too, the code is fine otherwise.

You can leave out the SetAlpha btw, it's not needed.
  Reply With Quote
02-01-11, 10:24 AM   #5
lilsparky
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 117
tileSize of 0 doesn't seem right to me.
  Reply With Quote
02-01-11, 04:07 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
But he's got tile set to false... (BTW - if you don't want to use everything in the SetBackdrop table, you can leave those fields out and they'll use default values.)

I think Haleth may be right, though. Where is your setcolor function defined?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with SetBackdrop?


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