We help IT Professionals succeed at work.

Put the curser to the end of an Edit1.text component

Darth_helge
Darth_helge asked
on
250 Views
Last Modified: 2010-04-05
Hi

Do any of you know how to put the curser to the end of an Edit1.text component?
Comment
Watch Question

Top Expert 2004
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Top Expert 2004

Commented:
appendix,

maybe use above in the onenter-event
Top Expert 2004

Commented:
well,
a small sample

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    procedure EditChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


//assigned to all OnEnter-event of the TEdits
procedure TForm1.EditChange(Sender: TObject);
begin
  if (Sender is TEdit) then
    TEdit(sender).selstart := length(TEdit(sender).text);
end;

end.

meikl ;-)
Top Expert 2004

Commented:
just to ask about the b-grade?

Author

Commented:
Sorry about that. Hit the wrong button. You’re answer is excellent, as always..
Top Expert 2004

Commented:
shall i do any action?

as page-editor for this topic,
i have a tool to unaccept an answer,
so you can accept with the correct grade again

meikl ;-)

Author

Commented:
OK
Top Expert 2004

Commented:
thanks :-)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.