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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:03:21+00:00 2026-05-17T01:03:21+00:00

I should implement periodically popup form at other form. This popup form isn’t common

  • 0

I should implement periodically popup form at other form. This popup form isn’t common design, so I couldn’t use standard messages. I need implement smoothly showing\hiding of this popup form.

Now I use timers for hide\show this form, but have strange problems.
If I run only Show\Hide popup form process all is OK, but when I try run other threads at base form,which are marshling to vcl thread (math painting) behaviour of popup form become strange.

How should I imlement thread-safe popup form at multi-thread app? Thanks

EDIT

Strange thing: My timers setup show show hide form with period 5s.
When process starts all is ok. Popup form is show and hide over 5s as expecting.
But then I got some cycles of popup(show popup from) withous pause.
Then again period of popup is OK(5s).
Then my timer intervals don’t work correctly.
I agree with ~4,6s period. But sometimes there is no periods between popup.

  • 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-17T01:03:22+00:00Added an answer on May 17, 2026 at 1:03 am

    Because you left out a lot of important information (“form is behaving strange” can be interpreted in about a zillion ways, with just as many solutions), I’m going to GUESS what your problem is, and attempt giving you a solution. Please provide relevant information if I’m wrong!

    About the TTimer:

    The TTimer is a simple solution when you need some timing signals but it’s not supposed to be very precise. You set up the timer to “fire” at the given Interval, and Windows will send your application WM_TIMER messages with the configured periodicity. The trick here is, there will never be two WM_TIMER messages on your application’s queue at the same time.

    If you were to make an clock, and used an TTimer to give you a 1 second heart-beat, your clock would be mostly on time when your computer is idle but it will run slow if your computer is busy. If the processes running the clock is busy the clock would run even slower.

    About your problem:

    You’re saying:

    If I run only Show\Hide popup form process all is OK, but when I try run other threads at base form,which are marshling to vcl thread (math painting) behaviour of popup form become strange.

    Interpretation: I assume the thread math painting is happening somewhere in the VCL thread, and that’s blocking your application’s message queue. This is turn is causing your application to skip WM_TIMER messages, causing the behaviour of popup form become strange.

    Possible solutions:

    This is obviously tough without actually knowing the problem (again, strange – how?), but I’m going to give you some ideas any way. First of all let me tell you, I don’t think you can fix your problem using a better timer. Your problem is GUI related, and the GUI is single-threaded. While you do have some background threads doing some stuff, they need to marshall to vcl thread – no matter how precise your timer is, it can’t stop the main VCL thread from doing the marshall thing, so the timer will need to wait for the marshall to finish in order to do what needs to be done.

    Taking hint from I need implement smoothly showing\hiding of this popup form I assume you need an number of steps for your smooth showing\hiding, and that’s what you’re using the TTimer for.

    If you got code like this:
    (warning, this is pseudo-code, I doubt it compiles)

    procedure Timer1OnTimer(Sender:TObject);
    begin
      SomeCounter := SomeCounter + 1;
      if SomeCounter > 10 then
        HidePopupForm
      else
        SetPopupFormTransparencyTo((SomeCounter * 255) div 10);
    end;
    

    Replace it with something like this:

    var HideAtTime:TDateTime;
        ShownAtTime:TDateTime;
    
    procedure Timer1OnTimer(Sender:TObject);
    var ExpectedVisibleTime:TDateTime;
        ElapsedVisibleTime:TDateTime;
    begin
      if Now > HideAtTime then
        HidePopupForm
      else
        begin
          ExpectedVisibleTime := HideAtTime - ShownAtTime;
          ElapsedVisibleTime := Now - ShownAtTime;
          SetPopupFormTransparencyTo(ElapsedVisibleTime/ExpectedVisibleTime*255);
        end;
    end;
    

    The general idea with this solution is to compute deadlines, store them in TDateTime variables, compare with Now from your TTimer.OnTimer; That way it doesn’t matter if the timer events don’t arrive at the requested intervals, you’d be mostly on time with everything else. Sure, showing up a form might not be as smooth as desired, but it’ll get the job done.

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

Sidebar

Related Questions

What single aspect of agile development should we implement first to improve our development
Can anyone give an idea of how should I implement undo/redo of cutting/copying/pasting of
Task: implement paging of database records suitable for different RDBMS. Method should work for
I want to implement forms authentication on an ASP.NET website, the site should seek
I'm still trying to decide whether my (home) project should use UTF-8 strings (implemented
Should a method that implements an interface method be annotated with @Override ? The
What do you think - which functions should be implemented to make work with
In a recent sharepoint project, I implemented an authentication webpart which should replace the
Should I start with Django or JavaScript?
Should the folders in a solution match the namespace? In one of my teams

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.