summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorv-rob <robinsonvincent89@gmail.com>2020-07-12 00:47:05 -0700
committerGitHub <noreply@github.com>2020-07-12 09:47:05 +0200
commite0499731a867c76005f7cd83ee18c1a9503da719 (patch)
tree31e145944ad335ecb84b41c0d0295d845bc2205e /doc
parentd80def5bbf58c9ddf1ab3d62e2e456b8dc824c98 (diff)
downloadminetest-e0499731a867c76005f7cd83ee18c1a9503da719.tar.gz
minetest-e0499731a867c76005f7cd83ee18c1a9503da719.tar.bz2
minetest-e0499731a867c76005f7cd83ee18c1a9503da719.zip
Allow FormSpec elements to be focused with `set_focus` (#9353)
This allows you to specify a FormSpec element to set the focus of with "set_focus[<name>;<always set>]".
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt26
1 files changed, 24 insertions, 2 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 2ac4d6766..4e6983be8 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2492,7 +2492,7 @@ Elements
* There are two ways to use it:
1. handle the changed event (only changed scrollbar is available)
2. read the value on pressing a button (all scrollbars are available)
-* `orientation`: `vertical`/`horizontal`
+* `orientation`: `vertical`/`horizontal`. Default horizontal.
* Fieldname data is transferred to Lua
* Value of this trackbar is set to (`0`-`1000`) by default
* See also `minetest.explode_scrollbar_event`
@@ -2606,6 +2606,28 @@ Elements
* All provided states must be active for the style to apply.
* See [Styling Formspecs].
+### `set_focus[<name>;<force>]`
+
+* Sets the focus to the element with the same `name` parameter.
+* **Note**: This element must be placed before the element it focuses.
+* `force` (optional, default `false`): By default, focus is not applied for
+ re-sent formspecs with the same name so that player-set focus is kept.
+ `true` sets the focus to the specified element for every sent formspec.
+* The following elements have the ability to be focused:
+ * checkbox
+ * button
+ * button_exit
+ * image_button
+ * image_button_exit
+ * item_image_button
+ * table
+ * textlist
+ * dropdown
+ * field
+ * pwdfield
+ * textarea
+ * scrollbar
+
Migrating to Real Coordinates
-----------------------------
@@ -4485,7 +4507,7 @@ Call these functions only at load time!
* a button was pressed,
* Enter was pressed while the focus was on a text field
* a checkbox was toggled,
- * something was selecteed in a drop-down list,
+ * something was selected in a dropdown list,
* a different tab was selected,
* selection was changed in a textlist or table,
* an entry was double-clicked in a textlist or table,