From c67ccaddea842bf832702bb9d616891e2421bf16 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 1 Sep 2019 19:16:08 +0100 Subject: [PATCH] Added text inputs --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common-Library.html | 2 +- docs/core/Gui.html | 384 +++++++++++++++++- docs/core/Permissions-Groups.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/core/Sudo.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../utils.alien_evolution_progress.html | 2 +- docs/modules/utils.core.html | 2 +- docs/modules/utils.debug.html | 2 +- docs/modules/utils.dump_env.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.math.html | 2 +- docs/modules/utils.recipe_locker.html | 2 +- docs/modules/utils.state_machine.html | 2 +- docs/modules/utils.table.html | 2 +- docs/modules/utils.task.html | 2 +- docs/modules/utils.timestamp.html | 2 +- docs/topics/license.html | 2 +- docs/topics/readme.md.html | 2 +- expcore/gui.lua | 2 + expcore/gui/concepts/slider.lua | 2 +- expcore/gui/concepts/textbox.lua | 60 +++ expcore/gui/concepts/textfield.lua | 76 ++++ expcore/gui/test.lua | 94 +++++ 97 files changed, 706 insertions(+), 94 deletions(-) create mode 100644 expcore/gui/concepts/textbox.lua create mode 100644 expcore/gui/concepts/textfield.lua diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index db08d972..31d501d2 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -348,7 +348,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 0dab0ebb..0b71ec19 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 319b02b1..0f83ae72 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index b91ba11d..6340ad99 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 2fc16b82..cf61c396 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index cd75a0ba..58ecdcf1 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 2b7b0567..62e674db 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -460,7 +460,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index d2bfde6a..9fdcc3ea 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index e7098e3f..05cfe35c 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index e0ffa93c..13a983b4 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index bd36335a..6a4b845e 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index ab42bec5..0dac6823 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 14323d1e..e208eee3 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 083b32fe..10c20a38 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index e5998899..6cf02737 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 290d58a9..5f227660 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index e466bfd8..9cfff9a3 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index f7e4975b..31462e7e 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 067a4076..e1982d23 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -458,7 +458,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index d280a73d..524a642d 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 93a8b942..f2dd5d21 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -611,7 +611,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 50690c73..75caf805 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 5b167987..254bda70 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index ead5dc2e..cbd8265f 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index f363411e..8d24324b 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -321,7 +321,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index d234cfa7..e5a9c808 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 32d24195..d49d1007 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -557,7 +557,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index a88bdecf..f1204717 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 9438cddc..d9c0085b 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -443,7 +443,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 9478e557..51598a49 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 2e0a0c76..d9581ee8 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -569,7 +569,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index cbb5cc3d..af6026bb 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -506,7 +506,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index eecdb55b..5c009894 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 77eac0c3..b23c07d5 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index f84fb637..73b6cd28 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -294,7 +294,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index dbe34891..b23d64fe 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 1531abfd..7f3c116b 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 877f1556..5a0b454f 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index aedabc41..66516970 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -338,7 +338,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 49196ffd..e636d935 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 6696e94b..63adb104 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 28f5b906..cb86d84e 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 1a46e4cf..e3cb46f4 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -240,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 22eb6228..8dfe6166 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -295,7 +295,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index cf496eff..0027c816 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -812,7 +812,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index a82ddebe..14621d46 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -384,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 659d3f76..65851fdb 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 5e487dad..b8e9a7f2 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -324,7 +324,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 2fcc9ed7..d8468dde 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 58b57990..4d7c8aa1 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -834,7 +834,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 55823fe3..0414689b 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -292,7 +292,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 1d26d319..2c7f4bf0 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 424aec99..7b1c22e4 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 5f2d3c3a..a7012781 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -744,7 +744,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index a2e222bc..5b9b0515 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -384,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index a8ffe551..3db69aec 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -355,7 +355,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index cb16c531..afe2df6d 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -684,7 +684,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 7af5c571..2bf7eb2b 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1208,7 +1208,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index def7e25c..389e1d52 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1329,7 +1329,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 822446ea..8c602cfd 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1110,7 +1110,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index f8ca492e..549afdb6 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -984,7 +984,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index c9a71a5d..c6c98a92 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1039,7 +1039,7 @@ generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 4b8ebd2d..f13263e7 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1465,7 +1465,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index f0a6938d..7a808d9e 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1413,7 +1413,7 @@ generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index fb2c4ff5..b7665406 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -1972,7 +1972,7 @@ generated by LDoc diff --git a/docs/core/Common-Library.html b/docs/core/Common-Library.html index 1f26b637..704bb0b4 100644 --- a/docs/core/Common-Library.html +++ b/docs/core/Common-Library.html @@ -2746,7 +2746,7 @@ Common.table_insert(tbl,50,tbl2) generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 55190867..7001ba8e 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -348,6 +348,14 @@ button:clone('CustomButton') slider The basic slider element + + text_box + The text box element + + + text_field + The text field element + @@ -1384,7 +1392,7 @@ Gui.clone_concept('progress_bar',boolean) - makes this slider a discrete slider (at time of writing unsure what this is) + makes this slider a discrete slider, this means that the slider button will stop at the same interval as the values do @@ -1436,6 +1444,378 @@ Gui.clone_concept('slider','dis end) + +
+
+
+ # + text_box +
+
+
+
+ +

The text box element

+

+ + + Properties / Events: + +
    + + + + + +
  • + + on_text_changed + + : + + + fired when the text within the text box is changed + +
  • + + + + + +
  • + + tooltip + + : + + (string or LocalisedString) + + the tooltip that shows when a player hovers over the text box + +
  • + + + + + +
  • + + default + + : + + (string or function) + + the default text that will appear in the text box, or a function that returns it + +
  • + + + + + +
  • + + clear_on_rmb + + : + + (boolean) + + if the text box will be cleared and forcused on a right click + +
  • + + + + + +
  • + + is_selectable + + : + + (boolean) + + when true the text inside the box can be selected + +
  • + + + + + +
  • + + has_word_wrap + + : + + (boolean) + + when true the text will wrap onto the next line if it reachs the end + +
  • + + + + + +
  • + + is_read_only + + : + + (boolean) + + when true the text inside the box can not be edited by the player + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Making a text box
+local basic_text_box =
+Gui.clone_concept('text_box','basic_text_box')
+:set_default('I am the text that will show in the text box')
+
-- Making a text box which can be edited
+local editible_text_box =
+Gui.clone_concept('text_box','editible_text_box')
+:set_is_read_only(false)
+:set_default('I am the text that will show in the text box')
+:on_confirmation(function(event)
+    event.player.print('Editible text box is now: '..event.element.text)
+end)
+ + +
+
+
+
+ # + text_field +
+
+
+
+ +

The text field element

+

+ + + Properties / Events: + +
    + + + + + +
  • + + on_text_changed + + : + + + fired when the text within the text field is changed + +
  • + + + + + +
  • + + on_confirmation + + : + + + fired when the player presses enter with the text field forcused + +
  • + + + + + +
  • + + tooltip + + : + + (string or LocalisedString) + + the tooltip that shows when a player hovers over the text field + +
  • + + + + + +
  • + + default + + : + + (string or function) + + the default text that will appear in the text field, or a function that returns it + +
  • + + + + + +
  • + + clear_on_rmb + + : + + (boolean) + + if the text field will be cleared and forcused on a right click + +
  • + + + + + +
  • + + lose_forcus + + : + + (boolean) + + if the text field will lose forcus after the confirmation event + +
  • + + + + + +
  • + + is_number + + : + + (boolean) + + if this text field contains a number value, can be ignored if is_decimal or is_negitive is used + +
  • + + + + + +
  • + + is_decimal + + : + + (boolean) + + if this text field contains a decimal value + +
  • + + + + + +
  • + + is_negative + + : + + (boolean) + + if this text field contains a negative value + +
  • + + + + + +
  • + + is_password + + : + + (boolean) + + if this text field contains a password value + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Making a text field
+local basic_text_field =
+Gui.clone_concept('text_field','basic_text_field')
+:on_confirmation(function(event)
+    event.player.print('Basic text field is now: '..event.element.text)
+end)
+
-- Making a text field which will clear on right click and un forcus on confirmation
+local better_text_field =
+Gui.clone_concept('text_field','better_text_field')
+:set_clear_on_rmb(true)
+:set_lose_forcus(true)
+:on_confirmation(function(event)
+    event.player.print('Better text field is now: '..event.element.text)
+end)
+
-- Making a decimal input
+local decimal_text_field =
+Gui.clone_concept('text_field','decimal_text_field')
+:set_is_decimal(true)
+:on_confirmation(function(event)
+    event.player.print('Decimal text field is now: '..event.element.text)
+end)
+ +

Dropdowns

@@ -4590,7 +4970,7 @@ Gui.get_concept('CustomButton') generated by LDoc diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html index 88c9d301..d6cfd67e 100644 --- a/docs/core/Permissions-Groups.html +++ b/docs/core/Permissions-Groups.html @@ -1432,7 +1432,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 939c59a1..90aaa30a 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3152,7 +3152,7 @@ generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index e518d5a6..c426c2a9 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1145,7 +1145,7 @@ Store.register(team_scores,function(value,key) generated by LDoc diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html index 36b4a432..cb87e968 100644 --- a/docs/core/Sudo.html +++ b/docs/core/Sudo.html @@ -544,7 +544,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 6c70132d..85e9bd5b 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -626,7 +626,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index ab679073..4f70f60a 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -629,7 +629,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index c59424c9..db01d658 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -449,7 +449,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index bb660351..da16f049 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -632,7 +632,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 66885bbe..293094c5 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -837,7 +837,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 7ed6c8dd..2d5a06dd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -510,7 +510,7 @@ see ./expcore/commands.lua for more details
generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 5723e3d4..377e2e4d 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -351,7 +351,7 @@ generated by LDoc diff --git a/docs/modules/utils.alien_evolution_progress.html b/docs/modules/utils.alien_evolution_progress.html index 8de5f2be..cb214d8e 100644 --- a/docs/modules/utils.alien_evolution_progress.html +++ b/docs/modules/utils.alien_evolution_progress.html @@ -419,7 +419,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on generated by LDoc diff --git a/docs/modules/utils.core.html b/docs/modules/utils.core.html index 738a0e75..4f6a5936 100644 --- a/docs/modules/utils.core.html +++ b/docs/modules/utils.core.html @@ -1164,7 +1164,7 @@ generated by LDoc diff --git a/docs/modules/utils.debug.html b/docs/modules/utils.debug.html index c560bc9d..967c465d 100644 --- a/docs/modules/utils.debug.html +++ b/docs/modules/utils.debug.html @@ -654,7 +654,7 @@ generated by LDoc diff --git a/docs/modules/utils.dump_env.html b/docs/modules/utils.dump_env.html index 74e7ec8a..5d97b286 100644 --- a/docs/modules/utils.dump_env.html +++ b/docs/modules/utils.dump_env.html @@ -323,7 +323,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 0f324e4b..ef1fb0ef 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1292,7 +1292,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index c2a42b72..c7c8acd0 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -434,7 +434,7 @@ generated by LDoc diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html index b53b1a2c..c653377a 100644 --- a/docs/modules/utils.math.html +++ b/docs/modules/utils.math.html @@ -338,7 +338,7 @@ generated by LDoc diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html index 6ba6a2cc..0a43c0e9 100644 --- a/docs/modules/utils.recipe_locker.html +++ b/docs/modules/utils.recipe_locker.html @@ -441,7 +441,7 @@ generated by LDoc diff --git a/docs/modules/utils.state_machine.html b/docs/modules/utils.state_machine.html index a7c7ae1c..fc44bc7b 100644 --- a/docs/modules/utils.state_machine.html +++ b/docs/modules/utils.state_machine.html @@ -752,7 +752,7 @@ generated by LDoc diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html index 71fdfc28..1a9ef65d 100644 --- a/docs/modules/utils.table.html +++ b/docs/modules/utils.table.html @@ -1382,7 +1382,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index c5a2596d..3d86cca1 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -651,7 +651,7 @@ generated by LDoc diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html index 2a54826a..e5be71ff 100644 --- a/docs/modules/utils.timestamp.html +++ b/docs/modules/utils.timestamp.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/topics/license.html b/docs/topics/license.html index 927f857f..2e77eb29 100644 --- a/docs/topics/license.html +++ b/docs/topics/license.html @@ -789,7 +789,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html index 9ced810b..50cc7c47 100644 --- a/docs/topics/readme.md.html +++ b/docs/topics/readme.md.html @@ -332,7 +332,7 @@ generated by LDoc diff --git a/expcore/gui.lua b/expcore/gui.lua index 7f28c635..54c8d512 100644 --- a/expcore/gui.lua +++ b/expcore/gui.lua @@ -74,5 +74,7 @@ Gui.require_concept('dropdown') Gui.require_concept('elem_button') Gui.require_concept('progress_bar') Gui.require_concept('slider') +Gui.require_concept('textfield') +Gui.require_concept('textbox') return Gui \ No newline at end of file diff --git a/expcore/gui/concepts/slider.lua b/expcore/gui/concepts/slider.lua index b58792d3..3cc90dbd 100644 --- a/expcore/gui/concepts/slider.lua +++ b/expcore/gui/concepts/slider.lua @@ -10,7 +10,7 @@ local Gui = require 'expcore.gui.core' @param on_value_changed fired when the value of the slider is changed @tparam number value_step the minimum amount by which the value of the slider can be changed @tparam ?number|function default the default value of the slider or a function which returns the default value -@tparam boolean discrete_slider makes this slider a discrete slider (at time of writing unsure what this is) +@tparam boolean discrete_slider makes this slider a discrete slider, this means that the slider button will stop at the same interval as the values do @tparam ?number|function range accepts two params the minimum and the maximum for this slider, or a single function to return both @usage-- Making a basic slider local basic_slider = diff --git a/expcore/gui/concepts/textbox.lua b/expcore/gui/concepts/textbox.lua new file mode 100644 index 00000000..3c3945eb --- /dev/null +++ b/expcore/gui/concepts/textbox.lua @@ -0,0 +1,60 @@ +--[[-- Core Module - Gui + @module Gui + @alias Gui +]] + +local Gui = require 'expcore.gui.core' + +--[[-- The text box element +@element text_box +@param on_text_changed fired when the text within the text box is changed +@tparam ?string|Concepts.LocalisedString tooltip the tooltip that shows when a player hovers over the text box +@tparam ?string|function default the default text that will appear in the text box, or a function that returns it +@tparam boolean clear_on_rmb if the text box will be cleared and forcused on a right click +@tparam boolean is_selectable when true the text inside the box can be selected +@tparam boolean has_word_wrap when true the text will wrap onto the next line if it reachs the end +@tparam boolean is_read_only when true the text inside the box can not be edited by the player +@usage-- Making a text box +local basic_text_box = +Gui.clone_concept('text_box','basic_text_box') +:set_default('I am the text that will show in the text box') +@usage-- Making a text box which can be edited +local editible_text_box = +Gui.clone_concept('text_box','editible_text_box') +:set_is_read_only(false) +:set_default('I am the text that will show in the text box') +:on_confirmation(function(event) + event.player.print('Editible text box is now: '..event.element.text) +end) +]] +Gui.new_concept('text_box') +:new_event('on_text_changed',defines.events.on_gui_text_changed) +:new_property('tooltip') +:new_property('default') +:new_property('clear_on_rmb',false) +:new_property('is_selectable',true) +:new_property('has_word_wrap',true) +:new_property('is_read_only',true) +:define_draw(function(properties,parent,element) + local default = properties.default + local text = type(default) == 'string' and default or nil + + element = parent.add{ + name = properties.name, + type = 'text-box', + tooltip = properties.tooltip, + clear_and_focus_on_right_click = properties.clear_on_rmb, + text = text + } + + element.selectable = properties.is_selectable + element.word_wrap = properties.has_word_wrap + element.read_only = properties.is_read_only + + default = Gui.resolve_property(default,element) + if default and default ~= text then + element.text = default + end + + return element +end) \ No newline at end of file diff --git a/expcore/gui/concepts/textfield.lua b/expcore/gui/concepts/textfield.lua new file mode 100644 index 00000000..717fe55c --- /dev/null +++ b/expcore/gui/concepts/textfield.lua @@ -0,0 +1,76 @@ +--[[-- Core Module - Gui + @module Gui + @alias Gui +]] + +local Gui = require 'expcore.gui.core' + +--[[-- The text field element +@element text_field +@param on_text_changed fired when the text within the text field is changed +@param on_confirmation fired when the player presses enter with the text field forcused +@tparam ?string|Concepts.LocalisedString tooltip the tooltip that shows when a player hovers over the text field +@tparam ?string|function default the default text that will appear in the text field, or a function that returns it +@tparam boolean clear_on_rmb if the text field will be cleared and forcused on a right click +@tparam boolean lose_forcus if the text field will lose forcus after the confirmation event +@tparam boolean is_number if this text field contains a number value, can be ignored if is_decimal or is_negitive is used +@tparam boolean is_decimal if this text field contains a decimal value +@tparam boolean is_negative if this text field contains a negative value +@tparam boolean is_password if this text field contains a password value +@usage-- Making a text field +local basic_text_field = +Gui.clone_concept('text_field','basic_text_field') +:on_confirmation(function(event) + event.player.print('Basic text field is now: '..event.element.text) +end) +@usage-- Making a text field which will clear on right click and un forcus on confirmation +local better_text_field = +Gui.clone_concept('text_field','better_text_field') +:set_clear_on_rmb(true) +:set_lose_forcus(true) +:on_confirmation(function(event) + event.player.print('Better text field is now: '..event.element.text) +end) +@usage-- Making a decimal input +local decimal_text_field = +Gui.clone_concept('text_field','decimal_text_field') +:set_is_decimal(true) +:on_confirmation(function(event) + event.player.print('Decimal text field is now: '..event.element.text) +end) +]] +Gui.new_concept('text_field') +:new_event('on_text_changed',defines.events.on_gui_text_changed) +:new_event('on_confirmation',defines.events.on_gui_confirmed) +:new_property('tooltip') +:new_property('default') +:new_property('clear_on_rmb',false) +:new_property('lose_forcus',false) +:new_property('is_number',false) +:new_property('is_decimal',false) +:new_property('is_negative',false) +:new_property('is_password',false) +:define_draw(function(properties,parent,element) + local default = properties.default + local text = type(default) == 'string' and default or nil + + element = parent.add{ + name = properties.name, + type = 'textfield', + tooltip = properties.tooltip, + clear_and_focus_on_right_click = properties.clear_on_rmb, + lose_focus_on_confirm = properties.lose_forcus, + numeric = properties.is_number or properties.is_decimal or properties.is_negative, + allow_decimal = properties.is_decimal, + allow_negative = properties.is_negative, + is_password = properties.is_password, + text = text + } + + default = Gui.resolve_property(default,element) + if default and default ~= text then + element.text = default + end + + return element +end) \ No newline at end of file diff --git a/expcore/gui/test.lua b/expcore/gui/test.lua index f6d74988..afee4f8f 100644 --- a/expcore/gui/test.lua +++ b/expcore/gui/test.lua @@ -514,4 +514,98 @@ tests.Sliders = { ['Discrete Slider'] = discrete_slider, ['Dynamic Slider'] = dynamic_slider, ['Player Stored Slider'] = player_slider +} + +--[[ +Text Fields +> Basic Text Field -- Just a text field which text can be entered into +> Better Text Field -- Same as above but will clear on rmb and un forcus on confirmation +> Decimal Text Field -- Text field which accepts decimal values +> Password Text Field -- Text field which stars out the typed characters +> Player Stored Text Field - Same as basic but will store value per player +]] + +-- Making a text field +local basic_text_field = +Gui.clone_concept('text_field',TEST 'basic_text_field') +:set_tooltip('Basic text field') +:on_confirmation(function(event) + event.player.print('Basic text field is now: '..event.element.text) +end) + +local better_text_field = +Gui.clone_concept('text_field',TEST 'better_text_field') +:set_tooltip('Better text field') +:set_clear_on_rmb(true) +:set_lose_forcus(true) +:on_confirmation(function(event) + event.player.print('Better text field is now: '..event.element.text) +end) + +local decimal_text_field = +Gui.clone_concept('text_field',TEST 'decimal_text_field') +:set_tooltip('Decimal text field') +:set_is_decimal(true) +:on_confirmation(function(event) + event.player.print('Decimal text field is now: '..event.element.text) +end) + +local password_text_field = +Gui.clone_concept('text_field',TEST 'password_text_field') +:set_tooltip('Password text field') +:set_is_password(true) +:on_confirmation(function(event) + event.player.print('Password text field is now: '..event.element.text) +end) + +local player_text_field = +Gui.clone_concept('text_field',TEST 'player_text_field') +:set_tooltip('Player stored text field') +:on_confirmation(function(event) + local element = event.element + local text = element.text + event.concept.set_data(element,text) + event.player.print('Player stored text field is now: '..text) +end) +:define_combined_store(Gui.categorize_by_player, function(element,value) + element.text = value or '' +end) + +tests['Text Fields'] = { + ['Basic Text Field'] = basic_text_field, + ['Better Text Field'] = better_text_field, + ['Decimal Text Field'] = decimal_text_field, + ['Password Text Field'] = password_text_field, + ['Player Stored Text Field'] = player_text_field +} + +--[[ +Text Boxs +> Basic Text Box -- A text box that can not be edited +> Editible Text Box -- A text box that can be edited +]] + +local basic_text_box = +Gui.clone_concept('text_box',TEST 'basic_text_box') +:set_tooltip('Basic text box') +:set_default('I am the text that will show in the text box') +:define_draw(function(properties,parent,element) + element.style.height = 75 +end) + +local editible_text_box = +Gui.clone_concept('text_box',TEST 'editible_text_box') +:set_tooltip('Editible text box') +:set_is_read_only(false) +:set_default('I am the text that will show in the text box') +:on_text_changed(function(event) + event.player.print('Editible text box is now: '..event.element.text) +end) +:define_draw(function(properties,parent,element) + element.style.height = 75 +end) + +tests['Text Boxs'] = { + ['Basic Text Box'] = basic_text_box, + ['Editible Text Box'] = editible_text_box } \ No newline at end of file