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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:05:09+00:00 2026-05-23T17:05:09+00:00

I used to able to do this using plain delphi buttons: In the First

  • 0

I used to able to do this using plain delphi buttons:

In the First Frame I have (simplified)

procedure FirstFrame.ButtonClick(Sender: TObject)
Begin
  if TButton(Sender).ModalResult = mrOK then
    ChildFrame.DoOKStuff
  else
    ChildFrame.DoCancelStuff;
  ChildFrame.Free;
end;

procedure FirstFrame.ShowFranme;
begin
  ChildFrame := TFrameWithButtons.Create(Owner);
  ChildFrame.Parent := self;
  ChildFrame.OKButton.OnClick := ButtonClick;
  ChildFrame.CancelButton.OnClick := ButtonClick;
  ChildFrame.Visible := True;
end;

In the Childframe I do nothing to process the button click… the button click is already set to return control to the First Frame.

With some third Party buttons this occasionally causes an AV.
I understand why – at some point in the 3rd party code processing returns to a now freed frame or button BUT the called code is in the first frame… Annoyingly it just works 99.99% of the time 🙂

There is no Release procedure for frames.

So my question is what is the correct way to handle this situation?

Using both Delphi 6 and Delphi 2009.

  • 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-23T17:05:10+00:00Added an answer on May 23, 2026 at 5:05 pm

    Try this:

    type
      TFrameWithButtons = class(TFrame)
        ...
        procedure CMRelease(var Message: TMessage); message CM_RELEASE;
        ...
      end;
    
    procedure TFrameWithButtons.CMRelease(var Message: TMessage);
    begin
      Free;
    end;
    
    procedure FirstFrame.ButtonClick(Sender: TObject)
    Begin
      if TButton(Sender).ModalResult = mrOK then
        ChildFrame.DoOKStuff
      else
        ChildFrame.DoCancelStuff;
      PostMessage(ChildFrame.Handle, CM_RELEASE, 0, 0);
    end; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to be able to do this to create an exported HTML page
I seem to not be able to do this (which I used to be
I used to be able to open a new buffer in Emacs quickly using
I'm used to using Telerik Grids and I'm able to display them in an
used to be able to do this without any problems: for (data in dataArray)
I used to be able to do the following in Preview 3 <%=Html.BuildUrlFromExpression<AController>(c =>
I used to be able to right click Folders in my project and click
As of SQL Server 2005, you used to be able to open a flat
With combo box controls, I'm used to being able tab to them, click the
I apologize in advance for the long post... I used to be able to

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.