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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:21:17+00:00 2026-06-07T23:21:17+00:00

I have a project with one FadeIn Timer and One FadeOut Timer. My form

  • 0

I have a project with one FadeIn Timer and One FadeOut Timer. My form is created by FadeIn Timer and is closed by FadeOut Timer. Initially FadeIn Timer is enabled and FadeOut Timer is disabled. FadeIn Timer Code :

if MainForm.AlphaBlendValue >= 235 then
  Timer01.Enabled := false 
else 
  MainForm.AlphaBlendValue := MainForm.AlphaBlendValue + 5;

FadeOut Timer Code :

if MainForm.AlphaBlendValue <= 0 then 
  Timer02.Enabled := false 
else 
  MainForm.AlphaBlendValue := MainForm.AlphaBlendValue - 5; 
close;

My requirement is that the FadeOut Timer will be active if I click on the “X” Button of the Caption Bar. So I defined

if Msg.Result=htClose then 
  FadeOutTimer.Enabled:=true;

But it not working. Please help me.

  • 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-06-07T23:21:18+00:00Added an answer on June 7, 2026 at 11:21 pm

    If the form just closes immediately, then you need a global form variable like FAllowClose that you set to False when the form is created. Then you need to write code for the Form.CloseQuery event. Something simple like this should work:

    procedure Form.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      if FAllowClose then
        Exit;
    
      CanClose := False;
      FadeOut.Enabled := True;
    end;
    
    procedure Form.FadeOutOnTimer(Sender: TObject);
    begin
      // do fade out
      FAllowClose := True;
      Self.Close
    end;
    

    <<< 2012/07/17 Edit >>>

    When the user clicks the “X” button on the form, the only one way to stop the form from closing is to cancel it in the OnCloseQuery event. Then when you are done fading out the form, you close the form. You’ll need a global variable like FAllowClose to signal the OnCloseQuery event that you are close the form instead of the user. This code is a little more illustrative, and should handle the situation where a user clicks the “X” again while it is fading out.

    interface
    
      type TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
        procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
        procedure FadeOutTimer(Sender: TObject);
      private
        FAllowClose: Boolean;
      public
      end;
    
    implementation
    
      procedure TForm1.FormCreate(Sender: TObject);
      begin
        FAllowClose := False;
      end;
    
      procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
      begin
        if FAllowClose then // <- is 'False' when user clicks "X"
          Exit;
    
        CanClose := False; // <- cancels close when user clicks "X"
        FadeOut.Enabled := True;
      end;
    
      procedure TForm1.FadeOutTimer(Sender: TObject);
      begin
        if Form1.AlphaBlendValue > 0 then
          Form1.AlphaBlendValue := Form1.AlphaBlendValue - 5
        else
        begin
          FadeOut.Enabled := False;
          FAllowClose := True;
          Self.Close;
        end;
      end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one project inside that I have SqlServerFunctions in test.cs file. code: [Microsoft.SqlServer.Server.SqlFunction]
I have one project where the code-signing popup is all whacked-out. On a normal
I have one project with is developed in Php and javascript. How to open
I have one project which has RIAService with entity framework that is referenced to
I currently have one project that currently contains multiple packages. These packages make up
i need to have one project on asp.net mvc 1 but i want to
Let's say I have one project with the following POM: <groupId>com.mine</groupId> <artifactId>coreJar</artifactId> <packaging>jar</packaging> <version>0.0.1-SNAPSHOT</version>
I have an SSIS project where one of the steps involves populating a SQL
I have migrated Project server from one server to another. I am able to
I have project in Dropbox and two running laptops: one with Ubuntu and one

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.