Files
factorio-scenario-ExpCluster/doc/modules/expcore.guiparts.inputs.html
Cooldude2606 f5153f3686 Doc Added
2018-05-29 20:15:20 +01:00

447 lines
15 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>ldoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/expcore.guiparts.center.html">expcore.guiparts.center</a></li>
<li><strong>expcore.guiparts.inputs</strong></li>
<li><a href="../modules/expcore.guiparts.left.html">expcore.guiparts.left</a></li>
<li><a href="../modules/expcore.guiparts.popup.html">expcore.guiparts.popup</a></li>
<li><a href="../modules/expcore.guiparts.toolbar.html">expcore.guiparts.toolbar</a></li>
<li><a href="../modules/expcore.commands.html">expcore.commands</a></li>
<li><a href="../modules/expcore.gui.html">expcore.gui</a></li>
<li><a href="../modules/expcore.ranking.html">expcore.ranking</a></li>
<li><a href="../modules/expcore.server.html">expcore.server</a></li>
<li><a href="../modules/expcore.sync.html">expcore.sync</a></li>
<li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgaminglib.control.html">modules.expgaminglib.control</a></li>
<li><a href="../modules/defines.color.html">defines.color</a></li>
<li><a href="../modules/Game.html">Game</a></li>
<li><a href="../modules/string.html">string</a></li>
<li><a href="../modules/table.html">table</a></li>
<li><a href="../modules/defines.time.html">defines.time</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/control.lua.html">control.lua</a></li>
<li><a href="../scripts/index.lua.html">index.lua</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>expcore.guiparts.inputs</code></h1>
<p>Sets the input to trigger on an certain event</p>
<p></p>
<h3>Usage:</h3>
<ul>
<pre class="example">button:on_event(defines.events.on_gui_click,player_return)
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#inputs._input:draw">inputs._input:draw (root)</a></td>
<td class="summary">Draw the input into the root element</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add">add (obj)</a></td>
<td class="summary">Add a new input, this is the same as doing frame.add{} but returns a diffrent object</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_elem_button">add_elem_button (name, elem_type, tooltip, callback)</a></td>
<td class="summary">Used to define a choose-elem-button callback only on elem_changed</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_checkbox">add_checkbox (name, radio, display, default, callback_true, callback_false)</a></td>
<td class="summary">Used to define a checkbox callback only on state_changed</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_radio">reset_radio (elements)</a></td>
<td class="summary">Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_text">add_text (name, box, text, callback)</a></td>
<td class="summary">Used to define a text callback only on text_changed</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_slider">add_slider (name, orientation, min, max, start_callback, callback)</a></td>
<td class="summary">Used to define a slider callback only on value_changed</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_drop_down">add_drop_down (name, items, index, callback)</a></td>
<td class="summary">Used to define a drop down callback only on value_changed</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "inputs._input:draw"></a>
<strong>inputs._input:draw (root)</strong>
</dt>
<dd>
Draw the input into the root element
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">root</span>
the element you want to add the input to
</li>
</ul>
<h3>Returns:</h3>
<ol>
returns the element that was added
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">button:draw(frame)</pre>
</ul>
</dd>
<dt>
<a name = "add"></a>
<strong>add (obj)</strong>
</dt>
<dd>
Add a new input, this is the same as doing frame.add{} but returns a diffrent object
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the new element to add if caption is a sprite path then sprite is used
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the custom input object
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add{<span class="global">type</span>=<span class="string">'button'</span>,name=<span class="string">'test'</span>,caption=<span class="string">'Test'</span>}</pre>
</ul>
</dd>
<dt>
<a name = "add_elem_button"></a>
<strong>add_elem_button (name, elem_type, tooltip, callback)</strong>
</dt>
<dd>
Used to define a choose-elem-button callback only on elem_changed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the name of this button
</li>
<li><span class="parameter">elem_type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the display for this button, either text or sprite path
</li>
<li><span class="parameter">tooltip</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the tooltip to show on the button
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
the callback to call on change function(player,element,elem)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the button object that was made, to allow a custom error event if wanted
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add_elem_button(<span class="string">'test'</span>,<span class="string">'Test'</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>)</pre>
</ul>
</dd>
<dt>
<a name = "add_checkbox"></a>
<strong>add_checkbox (name, radio, display, default, callback_true, callback_false)</strong>
</dt>
<dd>
Used to define a checkbox callback only on state_changed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the name of this button
</li>
<li><span class="parameter">radio</span>
<span class="types"><span class="type">boolean</span></span>
if this is a radio button
</li>
<li><span class="parameter">display</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the display for this button, either text or sprite path
</li>
<li><span class="parameter">default</span>
<span class="types"><span class="type">function</span></span>
the callback which choses the default check state
</li>
<li><span class="parameter">callback_true</span>
<span class="types"><span class="type">function</span></span>
the callback to call when changed to true
</li>
<li><span class="parameter">callback_false</span>
<span class="types"><span class="type">function</span></span>
the callback to call when changed to false
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the button object that was made, to allow a custom error event if wanted
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add_checkbox(<span class="string">'test'</span>,<span class="keyword">false</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>,<span class="keyword">function</span>,funvtion)</pre>
</ul>
</dd>
<dt>
<a name = "reset_radio"></a>
<strong>reset_radio (elements)</strong>
</dt>
<dd>
Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">elements</span>
can be a list of elements or a single element
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.reset_radio{radio1,radio2,...}</pre>
</ul>
</dd>
<dt>
<a name = "add_text"></a>
<strong>add_text (name, box, text, callback)</strong>
</dt>
<dd>
Used to define a text callback only on text_changed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the name of this button
</li>
<li><span class="parameter">box</span>
<span class="types"><span class="type">boolean</span></span>
is it a text box rather than a text field
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the starting text
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
the callback to call on change function(player,text,element)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the text object that was made, to allow a custom error event if wanted
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add_text(<span class="string">'test'</span>,<span class="keyword">false</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>)</pre>
</ul>
</dd>
<dt>
<a name = "add_slider"></a>
<strong>add_slider (name, orientation, min, max, start_callback, callback)</strong>
</dt>
<dd>
Used to define a slider callback only on value_changed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the name of this button
</li>
<li><span class="parameter">orientation</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
direction of the slider
</li>
<li><span class="parameter">min</span>
<span class="types"><span class="type">number</span></span>
the lowest number
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">number</span></span>
the highest number
</li>
<li><span class="parameter">start_callback</span>
<span class="types"><span class="type">function</span></span>
either a number or a function to return a number
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
the function to be called on value_changed function(player,value,percent,element)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the slider object that was made, to allow a custom error event if wanted
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add_slider(<span class="string">'test'</span>,<span class="string">'horizontal'</span>,<span class="number">1</span>,<span class="number">10</span>,<span class="number">5</span>,<span class="keyword">function</span>)</pre>
</ul>
</dd>
<dt>
<a name = "add_drop_down"></a>
<strong>add_drop_down (name, items, index, callback)</strong>
</dt>
<dd>
Used to define a drop down callback only on value_changed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
name of the drop down
</li>
<li><span class="parameter">items</span>
either a list or a function which returns a list
</li>
<li><span class="parameter">index</span>
either a number or a function which returns a number
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
the callback which is called when a new index is selected function(player,selected,items,element)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the drop-down object that was made, to allow a custom error event if wanted
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">Gui.inputs.add_drop_down(<span class="string">'test'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>},<span class="number">1</span>,<span class="keyword">function</span>)</pre>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-05-29 20:15:05 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>