How do I disable the backspace + delete keys in a textarea?

Just started using Construct 2? Post your questions here

Post » Tue Feb 02, 2016 12:44 pm

I'm making a simple a text editor that disables the backspace key for productivity reasons, and I'm not quite sure how to disable the backspace and delete keys.

Can anyone point me in the right direction, please? I'm a complete noob. I have no idea what I'm doing. :(
B
7
S
1
Posts: 1
Reputation: 472

Post » Tue Feb 09, 2016 9:14 am

it's not really a ''disable'' of sorts, since there does not appear to be an undo function by default, you could keep track of data entered in a variable on the OnChanged event, and when someone hits BackSpace or Delete revert the textbox to said variable?

It's not pretty, but it might just work.
B
5
S
1
Posts: 43
Reputation: 461

Post » Mon Feb 15, 2016 5:13 pm

So, you want the player to still enter text but not be able to delete the text?
B
21
S
5
Posts: 44
Reputation: 1,644

Post » Tue Feb 16, 2016 4:22 am

len(x) - return length of the string x

As Gumball said - make a variable to store the current state of the text box, only if the length of text is equal or greater than what it was previously.

System Compare Two Values - len(TextBox) < len(TextVariable) - Set TextBox to TextVariable
Else - Set TextVariable to TextBox
Mistakes were made.
B
52
S
26
G
110
Posts: 1,619
Reputation: 62,159


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 10 guests