-
Posted by Moolgar on Fri, 03 Oct 2008 19:28:39
hi... i tryed to follow Chapter 25 tutorial for "useing state headers in the "world of warcraft Programming Book"
but i getting an error msg. and i cant fuggure whats wrong... i searched over and over again for typo's but cant find any...
however, the code look like this
here is the code:
CreateFrame("Frame", "TestHeader", UIParent,
"SecureStateHeaderTemplate")
TestHeader:SetPoint("CENTER")local nextbutton = 1
function CreateTestButton()
local button = CreateFrame("Button",
"TestButton"..nextbutton,
"TestHeader",
"ActionBarButtonTemplate"
)
button:SetAttribute("useparent-statebutton", true)
TestHeader:SetAttribute("addchild", button)
if nextbutton > 1 then
button:setPoint("LEFT", _G["TestButton"..(nextbutton - 1)], "RIGHT")
end
local offsetX = - (nextbutton - 1) * button:GetWidth() / 2
TestButton:SetPoint("CENTER", TestHeader, "CENTER", offsetX, 0)
nextbutton = nextbutton + 1
return button
endi get a error msg that the CreateFrame function have to be : CreateFrame("frameType" [, "name"] [, parent] [, "template"])
i cant figure how i do it diferent then the tutorial,
-
Posted by Moolgar on Fri, 03 Oct 2008 19:28:39
hi... i tryed to follow Chapter 25 tutorial for "useing state headers in the "world of warcraft Programming Book"
but i getting an error msg. and i cant fuggure whats wrong... i searched over and over again for typo's but cant find any...
however, the code look like this
here is the code:
CreateFrame("Frame", "TestHeader", UIParent,
"SecureStateHeaderTemplate")
TestHeader:SetPoint("CENTER")local nextbutton = 1
function CreateTestButton()
local button = CreateFrame("Button",
"TestButton"..nextbutton,
"TestHeader",
"ActionBarButtonTemplate"
)
button:SetAttribute("useparent-statebutton", true)
TestHeader:SetAttribute("addchild", button)
if nextbutton > 1 then
button:setPoint("LEFT", _G["TestButton"..(nextbutton - 1)], "RIGHT")
end
local offsetX = - (nextbutton - 1) * button:GetWidth() / 2
TestButton:SetPoint("CENTER", TestHeader, "CENTER", offsetX, 0)
nextbutton = nextbutton + 1
return button
endi get a error msg that the CreateFrame function have to be : CreateFrame("frameType" [, "name"] [, parent] [, "template"])
i cant figure how i do it diferent then the tutorial,
-
Posted by jnwhiteh on Sat, 04 Oct 2008 16:11:28
Your code does NOT match the code posted in the book. In particular your CreateTestButton() function shouldstart with:
function CreateTestButton()
local button = CreateFrame(
"CheckButton",
"TestButton"..nextButton,
TestHeader,
"ActionBarButtonTemplate"
)The major difference is that you should use
"CheckButton"
as opposed to"Button",
andTestHeader
instead of"TestHeader"
. Let me know if that doesn't make sense for any reason. Also, why did you post five or six different times in different forums? That made it extremely difficult to figure out what you were doing..