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 276077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:51:51+00:00 2026-05-12T00:51:51+00:00

I have a TForm (TVehicleEditForm) with 3 identical TFrames (TVehicleUnitFrame) inside. The idea was

  • 0

I have a TForm (TVehicleEditForm) with 3 identical TFrames (TVehicleUnitFrame) inside.

The idea was that every instance of the frame handle own events by a eventhandler inside the frame. The problem is that the eventhandler is not called.

I have tried to assign the eventhandler by code inside the frame by overriding the Create method but the handler is not called in that case either.

But if I assign the eventhandler outside the frame from the form it works fine.
Like this:

fraVehicleUnitFrame1.cmdNewOwner.OnClick := fraVehicleUnitFrame1.cmdNewOwnerClick;
fraVehicleUnitFrame2.cmdNewOwner.OnClick := fraVehicleUnitFrame2.cmdNewOwnerClick;
fraVehicleUnitFrame3.cmdNewOwner.OnClick := fraVehicleUnitFrame3.cmdNewOwnerClick;

And this is only for one button!
As I have many components inside the frame this would result in many assignments…
Quite ugly code when this should be done directly in the object inspector.

I am using D2007. Any idea of the cause ?

Regards Roland

  • 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-12T00:51:51+00:00Added an answer on May 12, 2026 at 12:51 am

    The reason it works when you do it from code, is that you replace the pointer to the event handler, regardless of what was there before.

    At design-time, I have two possible places to set the handler. Suppose I have Frame1 in Unit1 and I place it on MyForm in MyUnit, I’ll have the opportunity to set the event handler in both places.

    In your case you want to set the event handler in the frame itself (Unit1 in my example), as the code it refers to is on the frame itself. If you do that, it should work. If you set the event handler on the place it is used (MyUnit), then the event handler will be assigned there.

    Delphi is clever enough to still call the event handler from your frame as long as that event handler was assigned before you added the one in the form. If you first added it on the form and then added the handler on the frame, the last one on the frame is not called.
    To make matters worse, if you remove the handler in the form it still won’t call the one on the frame.

    What you need to do is this:

    Right-Click your form and select View as Text. Scroll down to the frame. It should be something like:

    inline FrameX: fraVehicleUnitFrame1
    

    Beneath that, look for

    inherited cmdNewOwner: TButton
    

    There you should see something like:

    OnClick = FormOldClickHandler
    

    or perhaps

    OnClick = nil
    

    Delete this OnClick assignment, view as form again and save. All should be well. If you now select the button (or whatever cmdNewOwner is) on the form, the object inspector should show nothing next to that event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program with two TForm classes and have added a TMainMenu to
I have an Application layout that is based on a treeView at the left,
We have a Delphi 5 application, that is built without runtime packages, dlls or
Have an Action delegate and trying to use the ternary operator inside of it
Have a flash player that pops out into a separate popup browser window. And
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing 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.