It would be useful if Minetest supports a formspec element to show a text box.
The properties I wish are:
Read only
Looks like a label, only with multiple lines
Lua scripter specifies position, size and text of the textbox. Line breaks happen automatically at the end of the textbox, like for textareas.
Optional: A scrollbar for the whole textarea if the text is too long (like for textlists).
I don’t care about background. That could be added with the box element anyways, so I don’t see a need for it.
All current solutions I can imagine for multi-line text are ugly work arounds:
Create text from textlist. Downside: You must manually place line breaks as “,”. This in turn forces you to escape manually, because you can’t throw the text into minetest.formspec_escape, because those commas would be escaped, too!
Textarea. Downside: This is an input field which can be edited.
Manually placing labels line per line. Way too much work.
EDIT: Textarea supports multi-line text now, with scrollbar.
Last edited by Wuzzy on Sat Apr 09, 2022 13:53, edited 1 time in total.
Such a formspec element would be great! There had been multiple instances where I had to patch together information texts from labels or use textareas, although those don't look particulary fine. It's a pain to get a decently formatted message that's longer than two or three words at the player.
table[<X>,<Y>;<W>,<H>;<name>;<cell 1>,<cell 2>,...,<cell n>;<selected idx>]
^ show scrollable table using options defined by the previous tableoptions[]
^ displays cells as defined by the previous tablecolumns[]
^ x and y position the itemlist relative to the top left of the menu
^ w and h are the size of the itemlist
^ name fieldname sent to server on row select or doubleclick
^ cell 1...n cell contents given in row-major order
^ selected idx: index of row to be selected within table (first row = 1)
^ see also minetest.explode_table_event (main menu: engine.explode_table_event)
tableoptions[<opt 1>;<opt 2>;...]
^ sets options for table[]:
^ color=#RRGGBB
^^ default text color (HEX-Color), defaults to #FFFFFF
^ background=#RRGGBB
^^ table background color (HEX-Color), defaults to #000000
^ border=<true/false>
^^ should the table be drawn with a border? (default true)
^ highlight=#RRGGBB
^^ highlight background color (HEX-Color), defaults to #466432
^ highlight_text=#RRGGBB
^^ highlight text color (HEX-Color), defaults to #FFFFFF
^ opendepth=<value>
^^ all subtrees up to depth < value are open (default value = 0)
^^ only useful when there is a column of type "tree"
OMG!
While I was adding tooltips for the main menu, I figured out that textarea can be made read-only and looking like a multi-line label by leaving the “name” and “default” arguments empty and using the “label” as text.
@BrunoMine
I have to thank you for bumping this. I remember Wuzzy writing about his discovery, but couldn't find it when I was searching for it. Since I can still make use of it... I'm bookmarking. :)
Bumping this—I still haven't found a great solution for the initial spec. Textlist isn't great for me, because it is less flexible than open text, and it doesn't have horizontal scrollbars for long lines.
Bumping this—I still haven't found a great solution for the initial spec. Textlist isn't great for me, because it is less flexible than open text, and it doesn't have horizontal scrollbars for long lines.
You can use hypertext or a text field with no name