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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:38:02+00:00 2026-05-28T00:38:02+00:00

im working on a project using delphi 7 , The project is a maintenance

  • 0

im working on a project using delphi 7, The project is a maintenance project and im not the original coder of the project, i have a situation where i need to close a available form after it had been created through code under certain situations,The form is model

here is sample code of that

       var 
       frmStratum : TfrmStratum;
       begin
          if not assigned(frmStratum) then myMainForm.OnExecute(PropAction);
        end; 

inside myMainForm.OnExecute(PropAction); i have

frmStratum := TfrmStratum.Create(Self, Self as IStratum,inttostr(m_surveyno),Module,m_stations,false);

now the procedure TfrmStratum.FormActivate of TfrmStratum i do lots of calucaltion and write to database

var
  if (bMassStratumExport) AND (bDoneOne)  then
  begin
             //write to database..
  end;

now i have to do this atleast 20 times
that is

1. Create the form
2. onactivate do database writing
3. close TfrmStratum

since it is a modal form i cannot close if below from where i create it,so i wanted to close it onactivate as soon as the step 2 is done

now i have tried this

  if (bMassStratumExport) AND (bDoneOne) AND NOT (bReadyToclose) then
 begin
    //do database writing
    if bNowClo then frmStratum.close;
 end

EDIT :(edited to make the question more clear)

Onactivate of the form(frmStratum) , i want to close the modal form (frmStratum),so i do this

procedure TfrmStratum.FormActivate(Sender: TObject);
 begin
  if (bMassStratumExport) AND (bDoneOne) AND NOT (bReadyToclose) then
    begin
      //do database writing
      if bNowClo then self.close;// i need to close the form after after doing database write
    end
  end;

but the control while bugging goes to self.close but it doesnt close the form.
how to tackle this ?

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

    In the past when I needed to close a form during activation I posted a message to myself instead of calling self.close.

    PostMessage(Self.Handle, WM_CLOSE, 0, 0);
    

    I tried to find my original source that pointed me in this direction but I could not find it.

    PostMessage will return immediately and not wait for the message to be processed. Once the OnActivate function is finished and the message Delphi processing loop processes the message close will be called on your form.

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

Sidebar

Related Questions

I am working on a project using .Net mvc. I have a csharp class
Working on a console application using Delphi 7, and have run into a problem.
I'm working chequePrinting project using windows-form, where one of my requirement is to print
I'm working on a project using Visual C++ 6.0, and I need to be
I am working on a project using MySQL and PHP. I will have many
I'm working under project (using github) with my friend. The situation: My friend checkouted
I'm working on a project using Tkinter and Python. In order to have native
I'm working on a project using Windows 2008, .NET 3.5 and WCF for some
I am working on a project using rails 2.1.1. With the new release of
I am working on a project using Castle Active Record. I stumbled across the

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.