Files
Basalt2/docs/.vitepress/dist/assets/references_textfield.md.afd20788.js
Robert Jelic 31787b0e9b Fix
2025-02-16 18:04:24 +01:00

18 lines
5.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as s,o as e,c as a,Q as t}from"./chunks/framework.4313453f.js";const x=JSON.parse('{"title":"Textfield","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"references/textfield.md","filePath":"references/textfield.md","lastUpdated":null}'),n={name:"references/textfield.md"},l=t(`<h1 id="textfield" tabindex="-1">Textfield <a class="header-anchor" href="#textfield" aria-label="Permalink to &quot;Textfield&quot;"></a></h1><p>Textfields are objects that allow users to write text in multiple lines, similar to the default edit script.</p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to &quot;Properties&quot;"></a></h2><table><thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>lines</td><td>table</td><td>A collection of strings, where each string represents a separate line in the Textfield.</td></tr><tr><td>lineIndex</td><td>number</td><td>The current line number where the cursor is positioned.</td></tr><tr><td>scrollIndexX</td><td>number</td><td>The horizontal scroll position, determining which part of the text is visible when the text width exceeds the Textfield width.</td></tr><tr><td>scrollIndexY</td><td>number</td><td>The vertical scroll position, deciding which part of the text is visible when the number of lines exceeds the Textfield&#39;s height.</td></tr><tr><td>cursorIndex</td><td>number</td><td>The current position of the cursor within the line determined by lineIndex.</td></tr></tbody></table><h2 id="example" tabindex="-1">Example <a class="header-anchor" href="#example" aria-label="Permalink to &quot;Example&quot;"></a></h2><p>Heres a simple example showcasing how to instantiate a Textfield object within the Basalt framework:</p><div class="language-lua vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">lua</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> main </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> basalt.</span><span style="color:#79B8FF;">createFrame</span><span style="color:#E1E4E8;">()</span></span>
<span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> aTextfield </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">main</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">addTextfield</span><span style="color:#E1E4E8;">()</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">-- User writes text into the Textfield</span></span>
<span class="line"><span style="color:#6A737D;">-- ...</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">-- Retrieve the text from the Textfield</span></span>
<span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> allText </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">table.concat</span><span style="color:#E1E4E8;">(aTextfield.</span><span style="color:#B392F0;">lines</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;</span><span style="color:#79B8FF;">\\n</span><span style="color:#9ECBFF;">&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">basalt.</span><span style="color:#79B8FF;">debug</span><span style="color:#E1E4E8;">(allText)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> main </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> basalt.</span><span style="color:#005CC5;">createFrame</span><span style="color:#24292E;">()</span></span>
<span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> aTextfield </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">main</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">addTextfield</span><span style="color:#24292E;">()</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">-- User writes text into the Textfield</span></span>
<span class="line"><span style="color:#6A737D;">-- ...</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">-- Retrieve the text from the Textfield</span></span>
<span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> allText </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">table.concat</span><span style="color:#24292E;">(aTextfield.</span><span style="color:#6F42C1;">lines</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;</span><span style="color:#005CC5;">\\n</span><span style="color:#032F62;">&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">basalt.</span><span style="color:#005CC5;">debug</span><span style="color:#24292E;">(allText)</span></span></code></pre></div>`,7),o=[l];function p(r,c,i,d,h,y){return e(),a("div",null,o)}const f=s(n,[["render",p]]);export{x as __pageData,f as default};