Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread TEdit OnExit not executed
Tue, Aug 25 2020 1:15 AMPermanent Link

KimHJ

Comca Systems, Inc

I can't find out what is wrong with my Tedit OnExit Event.

I have two TEdit on a TDialog and onExit is not executed, but if I add ShowMessage in the OnExit event then it is executed.

This one are not executed:

procedure Edit1Exit(Sender: TObject);
begin
       If Length(Edit1.Text) > 2 then
          UpdateString;
end;

But this are:

procedure Edit1Exit(Sender: TObject);
begin
       If Length(Edit1.Text) > 2 then
          begin
                  ShowMessage('Here');
                  UpdateString;
          end;
end;

and this one:

procedure Edit1Exit(Sender: TObject);
begin
       ShowMessage('Here');
       If Length(Edit1.Text) > 2 then
          UpdateString;
          
end;

Anyone know why and how I can get it to execute without having to show a message?
Thanks,
Kim
Tue, Aug 25 2020 4:19 AMPermanent Link

Walter Matte

Tactical Business Corporation

You would do well to write a small project that reproduces the problem.  Describe the steps to cause the issue and post in binary.  Or send to Tim if it is a bug.

Walter


KimHJ wrote:

I can't find out what is wrong with my Tedit OnExit Event.

I have two TEdit on a TDialog and onExit is not executed, but if I add ShowMessage in the OnExit event then it is executed.

This one are not executed:

procedure Edit1Exit(Sender: TObject);
begin
       If Length(Edit1.Text) > 2 then
          UpdateString;
end;

But this are:

procedure Edit1Exit(Sender: TObject);
begin
       If Length(Edit1.Text) > 2 then
          begin
                  ShowMessage('Here');
                  UpdateString;
          end;
end;

and this one:

procedure Edit1Exit(Sender: TObject);
begin
       ShowMessage('Here');
       If Length(Edit1.Text) > 2 then
          UpdateString;
          
end;

Anyone know why and how I can get it to execute without having to show a message?
Thanks,
Kim
Tue, Aug 25 2020 9:11 AMPermanent Link

Matthew Jones

Walter Matte wrote:

> You would do well to write a small project that reproduces the problem.  Describe the steps to cause the issue and post in binary.  Or send to Tim if it is a bug.

And also step through it in the Chrome debugger - you may find that it is working just fine, but not as expected...

--

Matthew Jones
Tue, Aug 25 2020 3:15 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/25/2020 1:15 AM, KimHJ wrote:
> I can't find out what is wrong with my Tedit OnExit Event.
>
> I have two TEdit on a TDialog and onExit is not executed, but if I add ShowMessage in the OnExit event then it is executed.
....
>
> Anyone know why and how I can get it to execute without having to show a message?

What exactly do you do in the UpdateString ?

If adding showmessage works then it almost sounds like async/timing
issue of some sort

TEdit OnExit works for me here for simple things

Raul
Sat, Aug 29 2020 12:06 AMPermanent Link

KimHJ

Comca Systems, Inc

Raul wrote:

>>What exactly do you do in the UpdateString ?

If adding showmessage works then it almost sounds like async/timing
issue of some sort

TEdit OnExit works for me here for simple things<<

If I just enter this in the event;

x :=1;
Label1.Caption := IntToStr(x);

It never get executed, only if i enter the ShowMessage in the Event procedure.

I will make a little program and upload it.

Kim
Sun, Aug 30 2020 2:30 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/29/2020 12:06 AM, KimHJ wrote:
> If I just enter this in the event;
>
> x :=1;
> Label1.Caption := IntToStr(x);
>
> It never get executed, only if i enter the ShowMessage in the Event procedure.
>
> I will make a little program and upload it.

This works for me here.

Question - do you ONLY have edit and label on your form ?

The OnExit is fired on loss of focus and you need at least 1 more
focusable control on the form in addition to TEdit for OnExit to fire.

ShowMessage also causes loss of focus due to dialog form so that would
explain it working.

Raul
Sun, Aug 30 2020 6:36 PMPermanent Link

KimHJ

Comca Systems, Inc

Raul wrote:

>>This works for me here.

Question - do you ONLY have edit and label on your form ?

The OnExit is fired on loss of focus and you need at least 1 more
focusable control on the form in addition to TEdit for OnExit to fire.

ShowMessage also causes loss of focus due to dialog form so that would
explain it working. <<

Raul that did it I added another TEdit.
Thanks,
Kim
Image