Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:10+00:00 2026-05-31T13:08:10+00:00

I wrote an TEdit descendant which handles the OnExit event like so unit MyCustomEdit;

  • 0

I wrote an TEdit descendant which handles the OnExit event like so

unit MyCustomEdit;

interface

uses
  Classes,
  StdCtrls;

type
 TMyCustomEdit=class(TEdit)
 private
  procedure MyExit(Sender: TObject);
 public
  constructor Create(AOwner: TComponent); override;
 end;



implementation

{ TMyCustomEdit }

uses
 Dialogs;

constructor TMyCustomEdit.Create(AOwner: TComponent);
begin
  inherited;
  OnExit:=MyExit;
end;

procedure TMyCustomEdit.MyExit(Sender: TObject);
begin
  ShowMessage('Hello from TMyCustomEdit');//this is show only when is not assignated a event handler in the onexit event.
end;

end.

on the main form of my app i’m using Interposer class like so

unit UnitTest;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, MyCustomEdit;

type
  TEdit=class (TMyCustomEdit);
  TFormTest = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Edit1Exit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormTest: TFormTest;

implementation

{$R *.dfm}

procedure TFormTest.Edit1Exit(Sender: TObject);
begin
   ShowMessage('Hello from TFormTest');//this code is always executed
end;

end.

Now i want that when the Onexit event is assigned in the main form, my own onexit implementation of the TMyCustomEdit was executed as well the code of the OnExit event of the TFormTest form. but when i run the code only the code of the TFormTest.OnExit event is executed. How i can make which both methods implementations was executed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:08:12+00:00Added an answer on May 31, 2026 at 1:08 pm

    Override DoExit. That is the method which is called when the control lost focus, and which triggers the OnExit event. Call inherited DoExit after or before, depending on your desires:

    procedure TMyCustomEdit.DoExit;
    begin
      // Code here will run before the event handler of OnExit is executed
      inherited DoExit; // This fires the OnExit event, if assigned
      // Code here will run after the event handler of OnExit is executed
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote some man pages which I'd like to install from a MakeMaker. I'd
I wrote a process explorer using C with GUI interface. I want to add
I wrote a makefile which behaves oddly. You can find it here: http://pastebit.com/pastie/8215 Basically
I wrote a trajectory planner in Matlab, and I would like to compile as
I wrote a method tha uses myarray, defined in the same class. When I
I wrote a callback (I believe it's called) like this: hugeFadeIn(); It's a simple
I'm building a really crude GUI to model mapper which basically traverses all TEdit
I found this question on Experts-Exchange . Control's OnExit eats up mouseup event for
Wrote a quick Java proggy to spawn 10 threads with each priority and calculate
I wrote a symfony task to fill a database of sample data. Here's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.