Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here


how to now where is the curser location in Tedit

how to now where is the curser location in Tedit

how to now where is the curser location in Tedit

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 :
and seperate function :
function seperate(s:string):string;
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}

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

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

As to your question:

Where is the cursor in a TEdit Component..


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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close