View Single Post
01-07-11, 11:20 PM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Using functions:
Code:
function CFM_ToggleSetting(self, prop)
	local setting = activeProfile[selName]
	local frame = _G[setting.frame]
	local value = self:GetChecked() == 1
	local func
	if prop == "disableMouse" then
		func = frame.EnableMouse
	elseif prop == "clamp" then
		func = frame.SetClampedToScreen
	end
	setting[prop] = value
	func(frame, value)
end

Using methods:
Code:
function CFM_ToggleSetting(self, prop)
	local setting = activeProfile[selName]
	local frame = _G[setting.frame]
	local value = self:GetChecked() == 1
	local method
	if prop == "disableMouse" then
		method = "EnableMouse"
	elseif prop == "clamp" then
		method = "SetClampedToScreen"
	end
	setting[prop] = value
	frame[method](frame, value)
end
  Reply With Quote