Gaming
 

Khaos/Examples

From WoWWiki

This article is a part of the documentation of the Khaos function library

Contents

Options

Header

KhaosOption =  {
	type = K_HEADER;
	id = "Header";
	text = "Chat Scroll";
	helptext = "Scroll chat with the mousewheel.";
}

Checkbox

KhaosOption =  {
	type = K_TEXT;
	check = true;
	id = "ChatScroll";
	text = "Chat Scroll";
	helptext = "Scroll Chat with the Mousewheel.";
	callback = function(state) ChatFrameMod:SetChatScroll(state.checked) end;
	feedback = function(state) 
		if ( state.checked ) then 
			return "Mousewheel chat scrolling enabled.";
		else
			return "Mousewheel chat scrolling disabled.";
		end
	end;
	default = { checked = false };
	disabled = { checked = false };
}

Button

KhaosOption =  {
	type = K_BUTTON;
	id = "ScrollToTop";
	text = "Scroll To Top";
	helptext = "Scroll Chat to the Top.";
	callback = function() ChatFrameMod:ScrollToTop() end;
	feedback = function() return "Chat scrolled to top." end;
	setup = { buttonText = "Go!" };
}

Slider

KhaosOption =  {
	type = K_SLIDER;
	id = "ScrollSpeed";
	text = "Set Scroll Speed";
	helptext = "Set how many lines to scroll at once";
	callback = function(state) ChatFrameMod:SetScrollSpeed(state.slider) end;
	feedback = function(state) return "Scroll speed set to "..state.slider.." lines at once." end;
	setup = {
		sliderMin = 1;
		sliderMax = 20;
		sliderStep = 1;
		sliderText = "Choose a # from 1-20";
		sliderLow = "Slow";
		sliderHigh = "Fast";
	};
	default = { slider = 1 };
	disabled = { slider = 1 };
	dependencies = {
		["ChatScroll"] = { checked=true }; 
	};
}