lua Code:
-- disable mouse stuffs
cb = CreateFrame("CHECKBUTTON", "CFM_ClickButton", CFM_Panel1, "OptionsCheckButtonTemplate")
cb:SetPoint("LEFT", CFM_ClickText, "RIGHT", 0, 0)
cb:SetScale(.75)
cb:SetScript("OnClick", function(self)
if selName == nil or selName == "" then
print("Please select a frame first.")
return
else
CFM_ToggleSetting(self, "disableMouse")
end
end)
-- code stuffs
function CFM_ToggleSetting(self, prop)
local frame = _G[activeProfile[selName].frame]
local func
-- determine what function will be needed based on passed property
if prop == "disableMouse" then func = EnableMouse() end
if prop == "clamp" then func = SetClampedToScreen() end
if self:GetChecked() == 1 then
activeProfile[selName][prop] = true
frame:func(true)
else
activeProfile[selName][prop] = false
frame:func(false)
end
end
Code:
Message: Interface\AddOns\CFM\CFM_GUI.lua:1285: attempt to call global 'EnableMouse' (a nil value)
Time: 01/07/11 16:54:17
Count: 1
Stack: Interface\AddOns\CFM\CFM_GUI.lua:1285: in function `CFM_ToggleSetting'
Interface\AddOns\CFM\CFM_GUI.lua:835: in function <Interface\AddOns\CFM\CFM_GUI.lua:830>
Locals: self = CFM_ClickButton {
0 = <userdata>
}
prop = "disableMouse"
frame = PlayerFrame
As usually, I have an idea of what I'm doing wrong (the proper way to assign the desired function) but have no idea of how to do it. Ideas?