View Single Post
01-07-11, 04:58 PM   #1
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
"global EnableMouse is nil"

lua Code:
  1. -- disable mouse stuffs
  2.     cb = CreateFrame("CHECKBUTTON", "CFM_ClickButton", CFM_Panel1, "OptionsCheckButtonTemplate")
  3.         cb:SetPoint("LEFT", CFM_ClickText, "RIGHT", 0, 0)
  4.         cb:SetScale(.75)
  5.         cb:SetScript("OnClick", function(self)
  6.             if selName == nil or selName == "" then
  7.                 print("Please select a frame first.")
  8.                 return
  9.             else
  10.                 CFM_ToggleSetting(self, "disableMouse")
  11.             end
  12.             end)
  13.  
  14.  
  15. -- code stuffs
  16. function CFM_ToggleSetting(self, prop)
  17.     local frame = _G[activeProfile[selName].frame]
  18.     local func
  19.     -- determine what function will be needed based on passed property
  20.     if prop == "disableMouse" then func = EnableMouse() end
  21.     if prop == "clamp" then func = SetClampedToScreen() end
  22.     if self:GetChecked() == 1 then
  23.         activeProfile[selName][prop] = true
  24.         frame:func(true)
  25.     else
  26.         activeProfile[selName][prop] = false
  27.         frame:func(false)
  28.     end
  29. 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?
  Reply With Quote