INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# how to now where is the curser location in Tedit

## how to now where is the curser location in Tedit

(OP)
first i do apologize for my bad english so...
I want my numbers to be three digits separated by three digits in Tedit when user type number in Tedit.
like this :
1234 ---> 1,234
12345 ---> 12,345
1234567890 ---> 1,234,567,890
i use this code and its good but not enough.
in Tedit.onchange :
edit1.text:=seperate(edit1.text);
edit1.selstart:=length(edit1.text);
and seperate function :
function seperate(s:string):string;
var
i:integer;
s1:string;
begin
s1:='';
for i:=1 to length(s) do if copy(s,i,1)<>',' then s1:=s1+copy(s,i,1);
{for delete exist seperator from digit}
if length(s1)<4 then seperate:=s;
if length(s1)=4 then seperate:=copy(s1,1,1)+','+copy(s1,2,3);
if length(s1)=5 then seperate:=copy(s1,1,2)+','+copy(s1,3,3);
if length(s1)=6 then seperate:=copy(s1,1,3)+','+copy(s1,4,3);
if length(s1)=7 then seperate:=copy(s1,1,1)+','+copy(s1,2,3)+copy(s1,5,3);
if length(s1)=8 then seperate:=copy(s1,1,2)+','+copy(s1,3,3)+copy(s1,6,3);
if length(s1)=9 then seperate:=copy(s1,1,3)+','+copy(s1,4,3)+copy(s1,7,3);
...
{etc. on how many digit length that user want it}

end;
now if you write digit simple or delete the last digit by bkspace or delete the code is do right but if you want to delete on of the digit that is in between of digit after the delete curser jump to the end of line becuse of selstart order it means in 123,456,789 if you move the curser behind the 4 and delete it the curser jump to the end but i want to stop the curser in its location down the 5 digit In the above example.
Can someone help?

### RE: how to now where is the curser location in Tedit

There are formatting functions that will do this for you. Are you working through this problem to learn something?

### RE: how to now where is the curser location in Tedit

(OP)
hi
I do not know what you mean is the function
delphi library function? or forigen pakage?
Please specify what exactly function you mean
and last yes i want to control the curser in Tedit for several use

### RE: how to now where is the curser location in Tedit

Where is the cursor in a TEdit Component..

Edit1.SelStart;

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!