hi i use the text box object where the player can write free texts
i need to limit the text to one line, no more it is possible??
This will limit the number of characters to 20:
TextBox on text changed
System Compare two values len(TextBox.text)>20 : TextBox set text to Left(TextBox.text, 20)
thanks so much dop2000 do you know how can i add a sprite square at the end of each typed letter? like a blinking square cursor?
No I don't.. Maybe with CSS?
https://www.scirra.com/tutorials/1283/c ... -textboxes
nope not with css... i tried this formula
new x coordinate of sprite to text_user.x+len(text_user.Text) my coursor appears at the right place but doesn't move at the same speed im typing, it moves but too slow
i need to have the cursor after the typed text
And it never will. Also, how are you going to move the sprite if user presses keys like Left, Right, End, Home?
if the user tpress Enter for example then the cursor restart from the left side and text is set to ""
the right formula IS:
Every Tick > "spritename" > set text_user.TextWidth+len(text_user.Text)+110
and my sprite follow what i type at screen
if you change this "+110" by another number this will change the space between the last typed letter/space etc and the blinking cursor, for the blinking effect i used the flash behaviour set to 0.5
i can now make everything appear and be animated by just typing somme commands my first basic gui interface.
full size: http://oi66.tinypic.com/25hmgpt.jpg
Is this TextBox object or Text object? If it's textbox, what happens with the sprite if user moves cursor pressing buttons Left, Right, End, Home? Or decides to select text holding Shift?
Develop games in your browser. Powerful, performant & highly capable.
is the textbox object if you want to select the text, but i dont need it, you can change the scale to the mouse position x +len(text_user.Text) maybe im going to test it but everything works , perfectly
for Left, Right, End, Home you can add a function move to but for my need i dont use it because i just use one text line, no multiline
Have you tried typing several letters and then pres Left-Left-Left? Something tells me this will not work perfectly
i was trying to show you a video but i dont have a record sofware, but it works ! you just need to change the values i explained. with my basic one line+ blinking sprite a i can go at the end of teh screen right side, then move back and correct my text, cursor follow what i do if i change on letter or more etc.
values to change: Every Tick > "spritename" > set text_user.TextWidth+len(text_user.Text)+110
change then by adding the "left key" and change the values "spritename" > set text_user.TextWidth+len(text_user.Text)+110
i did a video for you:
Could you post the screenshot of your event that changes sprite position when Left key is pressed while typing text in TextBox?
I'm really curious how did you do this, I don't know how to detect key presses when TextBox is in focus.
i shared a video