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

  • Home
  • SEARCH
  • 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 291085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:03:25+00:00 2026-05-12T06:03:25+00:00

So, here is the discussion I have just read: http://www.mail-archive.com/delphi@delphi.org.nz/msg02315.html BeginUpdate and EndUpdate is

  • 0

So, here is the discussion I have just read:
http://www.mail-archive.com/delphi@delphi.org.nz/msg02315.html

BeginUpdate and EndUpdate is not thi procedures I need …

Overriding API Call? I tried to get Update procedures code from ComCtrls unit, nut did not found…

Maybe you could post here a code to fix thi flicker of statusbar compoent if the only text changes in it? I mean – something like TextUpdate or some kind of TCanvas method or PanelsRepaint … ?

The flickering is caused by this code:

Repeat
   BlockRead(Fp, BuffArrayDebug[LineIndex], DataCapac, TestByteBuff); // DataCapac = SizeOf(DWORD)
   ProgressBar1.StepIt;
   if RAWFastMode.Checked then begin       // checks for fast mode and modifyies progressbar
    if BuffArrayDebug[LineIndex] = 0 then begin ProgressBar2.Max := FileSize(Fp) - DataCapac; ProgressBar2.Position := (LineIndex + 1) * DataCapac; LineDecr := True; end;
   end else begin ProgressBar2.Max := FileSize(Fp); ProgressBar2.Position := LineIndex * DataCapac end;
   if PreviewOpn.Caption = '<' then begin  // starts data copying to preview area if expanded
    Memo1.Lines.BeginUpdate;
    if (LineIndex mod DataCapac) > 0 then HexMerge := HexMerge + ByteToHex(BuffArrayDebug[LineIndex]) else
     begin
      Memo1.Lines.Add(HexMerge); HexMerge := '';
     end;
    Memo1.Lines.EndUpdate;
   end;
   StatusBar1.Panels[0].Text := 'Line: ' + Format('%.7d',[LineIndex]) + ' | Data: ' + Format('%.3d',[BuffArrayDebug[LineIndex]]) + ' | Time: ' + TimeToStr(Time - TimeVarStart); StatusBar1.Update;
    if FindCMDLineSwitch(ParamStr(1)) then begin
     TrayIcon.BalloonTitle := 'Processing ' + ExtractFileName(RAWOpenDialog.FileName) + ' and reading ...';
     TrayIcon.BalloonHint :=  'Current Line: ' + inttostr(LineIndex) + #10#13 + ' Byte Data: ' + inttostr(TestByteBuff) + #10#13 + ' Hex Data: ' + ByteToHex(TestByteBuff);
     TrayIcon.ShowBalloonHint;
    end;
  Inc(LineIndex);
 Until EOF(Fp);

Any ideas?


There was comment with this link ( http://www.stevetrefethen.com/blog/UsingTheWSEXCOMPOSITEWindowStyleToEliminateFlickerOnWindowsXP.aspx ) and there is procedure that works ( no flickering whastsoever ), BUT IT IS VVVVVVVEEEEEERRRRRRYYYYYY SLOW!

 1 type
 2   TMyForm = class(TForm)
 3   protected
 4     procedure CreateParams(var Params: TCreateParams); override;
 5   end;
 6 
 7 ...
 8 
 9 procedure TMyForm.CreateParams(var Params: TCreateParams);
10 begin
11   inherited;
12   // This only works on Windows XP and above
13   if CheckWin32Version(5, 1) then
14     Params.ExStyle := Params.ExStyle or WS_EX_COMPOSITED;
15 end;
16 

Also – the target is not the form, but the StatusBar … how to assign this method to statusbar?

  • 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-12T06:03:25+00:00Added an answer on May 12, 2026 at 6:03 am

    The most important advise I can give you is to limit the number of status bar updates to maybe 10 or 20 per seconds. More will just cause unnecessary flicker, without any benefit for the user – they can’t process the information that fast anyway.

    OK, with that out of the way: If you want to use the WS_EX_COMPOSITED extended style for the status bar you have basically three options:

    • Create a descendent class that overrides the CreateParams() method and either install this into your IDE or (if you don’t want to have it as its own component in the IDE) create the status bar at runtime.

    • Create a descendent class with the same name TStatusBar in another unit, override the CreateParams() method, and add this unit after ComCtrls to the form units using status bar controls. This will create an instance of your own TStatusBar class instead of the one in ComCtrls. See this answer for another example of the technique, hopefully its clear enough.

    • Use the vanilla TStatusBar class and set the WS_EX_COMPOSITED extended style at runtime.

    I prefer the third option as the easiest one to experiment with, so here’s the sample code:

    procedure TForm1.FormCreate(Sender: TObject);
    var
      SBHandle: HWND;
    begin
      // This only works on Windows XP and above
      if CheckWin32Version(5, 1) then begin
        // NOTE: the following call will create all necessary window handles
        SBHandle := StatusBar1.Handle;
        SetWindowLong(SBHandle, GWL_EXSTYLE,
          GetWindowLong(SBHandle, GWL_EXSTYLE) or WS_EX_COMPOSITED);
      end;
    end;
    

    Edit:

    If you want your code to properly support recent Windows versions and visual styles you should not even think of handling WM_ERASEBKGND yourself – the usual technique involves an empty handler for that method, and drawing the background in the WM_PAINT handler. This doesn’t really work for standard controls like TStatusBar, as the background has to be drawn somewhere. If you just skip the background drawing in the WM_ERASEBKGND handler you will need to use owner-drawn panels spanning all of the status bar, otherwise the background simply won’t be drawn, and the window underneath will shine through. Besides, the code for the owner-drawn panel would probably be very complex.

    Again, a much better course of action would be to untangle the mess in your posted code, properly separate worker from display code, and reduce the update speed of your status bar texts to something reasonable. There just isn’t any sense at all in going past the number of monitor updates per second, and even this is sensible only for games and similar visualizations.

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

Sidebar

Related Questions

Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
I have read the discussion on how to create a DMG for Mac OS
I have seen lots of discussion on the problem of sending mail from an
I have subscribed to beginners@perl.org A discussion was going on there and a guy
I've set up a jsFiddle here , code below. I just have a textarea
I have read a lot of discussions here on SO, watched Jon Moore's presentation
The discussion here describes the display view in eclipse which allows one to to
We are having another discussion here at work about using parametrized sql queries in
We're having this discussion here. Which is better and why? 1) a php file
I've searched and found a good discussion here on SO , but it is

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.