Thread Tools Display Modes
03-30-11, 05:48 AM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation background layer. help

Hey all. was building myself a background for my ui, to sit at the bottom to sort of hold my chat and action buttons. and it works fine. but when i went to do a screen-shot and press alt and z. the background as still showing. any help would be good.

i did try with SetFrameLevel(1) and SetAlpha(1) and SetFrameStrata("LOW") but with no luck.

Code:
local backgroundimg = CreateFrame("frame")
backgroundimg:SetPoint("CENTER", UIParent, "BOTTOMRIGHT", -434, 20)
backgroundimg:SetWidth(1177) 
backgroundimg:SetHeight(380)
backgroundimg:SetBackdrop({bgFile = "interface\\Tooltips\\UI-Tooltip-Background"})
backgroundimg:SetBackdropColor(54/255, 54/255, 54/255)
backgroundimg:Show()
backgroundimg:SetScale(0.8)
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
03-30-11, 06:03 AM   #2
Ammo
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 17
As far as I know everything parented to UIParent is hidden. So you should do.

local backgroundimg = CreateFrame("frame", nil, UIParent)
  Reply With Quote
03-31-11, 11:20 AM   #3
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

Originally Posted by Ammo View Post
As far as I know everything parented to UIParent is hidden. So you should do.

local backgroundimg = CreateFrame("frame", nil, UIParent)
lol how silly. could i forget not to look at the createframe code. thanks for the help.

also. i wanted to make it move. and it seems to be working.

but when i do a /rl it didn't save the place. i hoped it would save in the layout file.

any help would be great.

Code:
local backgroundimg = CreateFrame("frame", myStuff, UIParent)
backgroundimg:SetPoint("CENTER", UIParent, "BOTTOMRIGHT", -500, 30)
backgroundimg:SetWidth(1177) backgroundimg:SetHeight(380)
backgroundimg:SetBackdrop({bgFile = "interface\\Tooltips\\UI-Tooltip-Background"})
backgroundimg:SetBackdropColor(54/255, 54/255, 54/255)
backgroundimg:Show()
backgroundimg:SetScale(0.8)
backgroundimg:EnableMouse(true)
backgroundimg:SetMovable(true)

backgroundimg:SetScript("OnDragStart", function(self)
  backgroundimg:SetScript("OnDragStop", function (self)
    backgroundimg:SetScript("OnDragStop", nil)
    backgroundimg:StopMovingOrSizing()
  end)
  if IsShiftKeyDown() then 
  backgroundimg:StartMoving()
end
end)
backgroundimg:RegisterForDrag("LeftButton")
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.

Last edited by weasoug : 03-31-11 at 11:25 AM.
  Reply With Quote
03-31-11, 11:56 AM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
The script handlers are a bit strange.

Try

Code:
backgroundimg:SetScript("OnDragStart", function(self) if IsShiftKeyDown() then  self:StartMoving() end end)
backgroundimg:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  Reply With Quote
03-31-11, 12:15 PM   #5
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

Originally Posted by Duugu View Post
The script handlers are a bit strange.

Try

Code:
backgroundimg:SetScript("OnDragStart", function(self) if IsShiftKeyDown() then  self:StartMoving() end end)
backgroundimg:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
yes i have tried that way also. but i had to add the RegisterForDrag still. and i also added SetUserPlaced as i read that is what makes it save to the layout. like

Code:
local backgroundimg = CreateFrame("frame", myStuff, UIParent)
backgroundimg:SetPoint("CENTER", UIParent, "BOTTOMRIGHT", -500, 30)
backgroundimg:SetWidth(1177) backgroundimg:SetHeight(380)
backgroundimg:SetBackdrop({bgFile = "interface\\Tooltips\\UI-Tooltip-Background"})
backgroundimg:SetBackdropColor(54/255, 54/255, 54/255)
backgroundimg:Show()
backgroundimg:SetScale(0.8)
backgroundimg:EnableMouse(true)
backgroundimg:SetMovable(true)

backgroundimg:SetScript("OnDragStart", function(self) if IsShiftKeyDown() then  self:StartMoving() end end)
backgroundimg:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)

backgroundimg:SetUserPlaced(true)
backgroundimg:RegisterForDrag("LeftButton")
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
03-31-11, 07:36 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
you're missing :SetUserPlaced(true)
__________________
"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
04-01-11, 08:49 AM   #7
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

Originally Posted by Seerah View Post
you're missing :SetUserPlaced(true)
no as you can see in my last post. i put that as a try also.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
04-01-11, 08:57 AM   #8
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
Maybe you should register for drag before you set the script
  Reply With Quote
04-01-11, 09:23 AM   #9
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

Originally Posted by Sniffles View Post
Maybe you should register for drag before you set the script
that is also on what i posted.

Code:
local backgroundimg = CreateFrame("frame", myStuff, UIParent)
backgroundimg:SetPoint("CENTER", UIParent, "BOTTOMRIGHT", -500, 30)
backgroundimg:SetWidth(1177) backgroundimg:SetHeight(380)
backgroundimg:SetBackdrop({bgFile = "interface\\Tooltips\\UI-Tooltip-Background"})
backgroundimg:SetBackdropColor(54/255, 54/255, 54/255)
backgroundimg:Show()
backgroundimg:SetScale(0.8)
backgroundimg:EnableMouse(true)
backgroundimg:SetMovable(true)

backgroundimg:SetScript("OnDragStart", function(self) if IsShiftKeyDown() then  self:StartMoving() end end)
backgroundimg:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)

backgroundimg:SetUserPlaced(true)
backgroundimg:RegisterForDrag("LeftButton")
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
04-01-11, 09:27 AM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
He said "before".
__________________
"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
04-01-11, 09:52 AM   #11
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

Originally Posted by Seerah View Post
He said "before".
lol how silly, guess what it was.

local backgroundimg = CreateFrame("frame", myStuff, UIParent)

should be

local backgroundimg = CreateFrame("frame", "myStuff", UIParent)


thanks all.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
04-01-11, 10:27 AM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
oh, duh >< hehe

without the quotes, you're passing a variable (which is obviously nil) to your frame name, hence it didn't save.
__________________
"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
04-02-11, 10:43 AM   #13
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Wink

Originally Posted by Seerah View Post
oh, duh >< hehe

without the quotes, you're passing a variable (which is obviously nil) to your frame name, hence it didn't save.
The next thing i cant work out is why. when i remove the code to wear i moved it. from layout-local and do a reload. its still in the place i left it. its like its saving else where. but i have looked around and nothing.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
04-02-11, 11:17 AM   #14
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by weasoug View Post
The next thing i cant work out is why. when i remove the code to wear i moved it. from layout-local and do a reload. its still in the place i left it. its like its saving else where. but i have looked around and nothing.
I would say the reason is, if you edit the layout file while you're ingame, and then do reload, then first wow writes the current position into the file (and overwrites your changes) and than wow reloads the frames position from the layout file.
  Reply With Quote
04-02-11, 09:26 PM   #15
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
I've done this with macros to load them while playing, I'm fairly sure it would work to load in other modified configurations.
  1. Edit the contents of the configuration file.
  2. Save changes.
  3. Set the file's Read-Only attribute.
  4. Reload the game UI.
  5. Clear the file's Read-Only attribute.

The point is, if the configuration file has its Read-Only attribute set at the time the UI is reloaded, the data inside it will be left alone. Then the game will actually read the file still and load in its contents when the UI re-initializes.
__________________
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)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » background layer. help


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