Controlling the keyboard cursor in TEdit
Posted on 1997-08-28
I just tried to customize an edit control to change some
of its keys. I wish for the control to display a different
character instead of the one clicked. For example: I'll
click '1' and it'll add '2' instead. I have the translation
table I need.
What I did it to add an event handler to the KeyPress
/KeyDown events. My event handlers would temporarily
make the TEdit compo ReadOnly so that it won't respond
to the actual key pressed. The second thing I did was
to alter the edit's text property.
Eg. Edit1. Text:= Edit1. Text + 'A';
My problem: when I change the text property the text
cursor is automatically moved to the beginning of the
edit field hence not allowing me to normally use the
I can override the other keys ( left, right, backspace... )
to do what is needed but I wish that damn cursor to be
where it is supposed to be.
Another thing, how can I change the TEdit's text alignment?