Page 1 of 1

how to disallow cursor from going backwords in a textbox of

Posted: Sat Oct 31, 2009 8:40 pm
by mario
hi guys,
i have created a textbox, lets call is txtHistory, type=string.
now, when user has clicked inside the text box, i dont want him to be able to move backwords.

the reason i want this so whatever is the previous value is there, it cant be overwritten and he can only add data in addition to the existing data inside the textbox.

Is it possible?

thnx :)

Re: how to disallow cursor from going backwords in a textbox of

Posted: Sun Nov 01, 2009 2:08 am
by ghosttie
You could make a subclass of TextBox whose keyPress method does this:

Code: Select all

keyPress(textbox: TextBox input; keyCharCode: Integer io) updating, clientExecution; vars begin inheritMethod(textbox, keyCharCode); if keyCharCode = J_key_Back then keyCharCode := 0; endif; end;
Or you could filter it on the form like this:

Code: Select all

keyDown(keyCode: Integer io; shift: Integer) updating; vars begin if keyCode = J_key_Back then keyCode := 0; endif; end;
This option will keep any controls on the form from receiving backspace key presses, so you'd probably have to add some code to only do that if specific controls had focus.

Re: how to disallow cursor from going backwords in a textbox of

Posted: Sun Nov 01, 2009 9:36 am
by mario
thanks and how can i also disable the delete key?

cheers, mario :)

Re: how to disallow cursor from going backwords in a textbox of

Posted: Sun Nov 01, 2009 9:37 am
by mario
spoke too early...figured it out :)

many thanks :)