Cursor position inside a maskedit box

I can't seem to get the cursor to go to the very left of a mask edit box.  Is there a simple way to make sure that anytime this box is entered the cursor will automatically move to the very left....Keep in mind there is a editmask on this box...when I remove it the cursor always goes to the left, but when the editmask is present I need to double click inside the box...for windows to move it over.....Any ideas???
GGriffithAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RBertoraCommented:
Hi, this is a bit of a hack but will work, just add more lines if your maskedit is longer than 6 backspaces..

Rob ;-)

procedure TForm1.MaskEdit1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
    Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
      Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
        Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
          Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
            Sendmessage(Maskedit1.handle,WM_Keydown,37,0);
end;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GGriffithAuthor Commented:
Thank you.....
0
kretzschmarCommented:
hi ggriffith,

not sure what you mean, but what about this:

procedure TForm1.MaskEdit1Enter(Sender: TObject);
begin
  Maskedit1.SelStart := 0;
end;

meikl
0
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

kretzschmarCommented:
oops, just accepted at this moment ;-)
0
GGriffithAuthor Commented:
What I was trying to get across is if you click in the edit box say at the 10 character position I wanted the cursor to move all the way over to the very left say position 0.

I've tried setting the SelStart property...It doesn't seem to work if there is an editmask set...

The sendmessage routine above seems to work, but it is cumbersome....Any other hints...
0
kretzschmarCommented:
well,

did you tried this also

//the OnClick-Event
procedure TForm1.MaskEdit1Click(Sender: TObject);
begin
  Maskedit1.SelStart := 0;
end;

meikl
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.