Thread Tools Display Modes
06-25-10, 03:14 AM   #1
mog
A Murloc Raider
Join Date: Jun 2010
Posts: 5
Need Help with Buttons

Ok im a Newbie in Lua and i have a problem to copy a Button.

I create a Button with:

local newbutton = CreateFrame("Button", "NewButton", Frame1, "ActionButtonTemplate")
newbutton:SetPoint("TOP")
newbutton:SetBackdrop({bgFile = select(3, GetSpellInfo(2484))})
newbutton:SetFrameLevel(Frame1:GetFrameLevel() + 1)

ok that works fine

Now i want to copy this button to an existing Button.

This dosnt work for me.
existingButton = newbutton

How can i copy an button to another Button???
Thanx for any help.

Last edited by mog : 06-25-10 at 04:56 AM.
  Reply With Quote
06-25-10, 04:05 AM   #2
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
If you mean changing the exisiting variable to point to the new button then you've done it but as far as I know you can't replace frames with the same frame name.

you use newbutton at the start then airbutton at the end, make sure you're doing it right.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 06-25-10 at 04:09 AM.
  Reply With Quote
06-25-10, 04:17 AM   #3
mog
A Murloc Raider
Join Date: Jun 2010
Posts: 5
Ok Copy and Past error...

I mean:
existingButton = newbutton

Nothing happens... no error no switching of the buttonlayout

existingButton and newbutton don't have the same name...
  Reply With Quote
06-25-10, 04:59 AM   #4
mog
A Murloc Raider
Join Date: Jun 2010
Posts: 5
Ok i think
existingButton = newbutton works partielle

The name of the existingButtons are switching but the Icon doesn't change.
Why??
  Reply With Quote
06-25-10, 05:18 AM   #5
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
To provide further help; please explain what are you trying to do
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need Help with Buttons


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