Two days ago I uploaded an idea for a text entry box and asked for ideas to improve it.
@ingox showed a far superior way to achieve the text handling and a recommendation to capture a click via a struct..
I've taken the liberty of using a big chunk of ingox's code.
I've added a cursor - mostly to show the box is still active
This is the result.
Click anywhere in the box to activate, the box will be cleared and the cursor will appear and flash at left side.
After typing, press 'enter' and the box will output a symbol of the text, the cursor will be hidden indicating the box is now inactive, but the text remains until the box is clicked again
Messages are currently the only way to set the properties. Decide the number of characters and the font size first
Then make sure you are not in edit mode and type characters from the start until the maximum characters are reached
Now size the box so that the right side is the same as the text width, and centre the text up and down with textpos
All the other properties change at any point.
IMPORTANT:-DO NOT type a backspace in the box when in edit mode, it will delete the [textentry] object
IMPORTANT:-textentry is only suitable for monospace fonts
IMPORTANT:-always have the box width the same size as the width of the maximum characters typed or the cusor position will be wrong.
size nn (width height)
textcol n (struct rgb format 0-999)
backcol n (struct rgb format 0-999)
bordercol n (struct rgb format 0-999)
cursorcol n (struct rgb format 0-999)
fontsize n n (font fontsize)
textpos n n (left top)
chars n (max characters)