how to disallow cursor from going backwords in a textbox of

For questions and postings not covered by the other forums
mario
Posts: 11
Joined: Fri Sep 04, 2009 11:02 am

how to disallow cursor from going backwords in a textbox of

Postby mario » Sat Oct 31, 2009 8:40 pm

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 :)

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

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

Postby ghosttie » Sun Nov 01, 2009 2:08 am

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.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

mario
Posts: 11
Joined: Fri Sep 04, 2009 11:02 am

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

Postby mario » Sun Nov 01, 2009 9:36 am

thanks and how can i also disable the delete key?

cheers, mario :)

mario
Posts: 11
Joined: Fri Sep 04, 2009 11:02 am

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

Postby mario » Sun Nov 01, 2009 9:37 am

spoke too early...figured it out :)

many thanks :)


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 23 guests