Recent

Author Topic: TCalendarLite - DoubleBuffered - Classic Theme: Doesn't work at all ?!  (Read 608 times)

RAW

  • Hero Member
  • *****
  • Posts: 794
This morning I downloaded a component (TCalendarLite 0.3.4) and wanted to start playing around with it, but with a classic theme it's impossible because of too much flickering.

W7 SP1 x64: DoubleBuffered:= True has no effect.
XP  SP3 x86: DoubleBuffered:= True has no effect, but looks a bit better // not much though ...

- Clicking on the Month/Year buttons is OK.
- Using VK_PRIOR or VK_NEXT is OK too.

Can anybody confirm this ... Anybody who uses a classic theme ?


I did almost nothing ...
Code: Pascal  [Select]
  1. Procedure TwndGUI.FormCreate(Sender: TObject);
  2. Begin
  3.   DoubleBuffered:= True; // classic theme
  4.   BorderStyle   := bsNone;
  5.   Color         := clBlack;
  6.   SetBounds     ((Screen.WorkAreaWidth -1280) Div 2,
  7.                  (Screen.WorkAreaHeight- 768) Div 2,
  8.                  1280, 768);
  9.  
  10.  
  11.   CAL                         := TCalendarLite.Create(Self);
  12.   CAL.SetBounds               (0, 0, Width, Height);
  13.   CAL.DoubleBuffered          := True; // classic theme
  14.   CAL.StartingDayOfWeek       := dowMonday;
  15.   CAL.Colors.BackgroundColor  := clBlack;
  16.   CAL.Colors.SelectedDateColor:= RGBToColor(0, 80, 255);
  17.   CAL.Font.Size               := 20;
  18.   CAL.Font.Quality            := fqAntialiased;
  19.   CAL.Parent                  := Self;
  20. End;
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.4 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

jamie

  • Hero Member
  • *****
  • Posts: 1925
I don't know the component but you can try this..

CAL.Brush.Style := bsClear;

That should take care of the WM_EREASEBK message..

Or I guess you could trap that message !

RAW

  • Hero Member
  • *****
  • Posts: 794
Thanks for the info ...

Code: Pascal  [Select]
  1. CAL.Brush.Style := bsClear;
This seems to have no effect ...

Quote
Or I guess you could trap that message !
Like this or directly inside that component?
Code: Pascal  [Select]
  1. // Procedure WndProc (Var MSG: TMessage); Override;
  2.  
  3. Procedure TwndGUI.WndProc(Var MSG: TMessage);
  4. Begin
  5.   If MSG.MSG = WM_ERASEBKGND
  6.   Then MSG.Result:= 1
  7.   Else Inherited WndProc(MSG);
  8. End;
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.4 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

jamie

  • Hero Member
  • *****
  • Posts: 1925
You can try it.

Its also possible the control is doing it itself..

But the WM_EraseBk is a very common way to reduce the flicker..

wp

  • Hero Member
  • *****
  • Posts: 6158
This will not work. The component uses too many background erasing steps internally.

Please try the new version in ccr trunk which paints into a bitmap buffer first. In order to update your current installation I think it is enough to copy https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/callite/source/calendarlite.pas over the existing file.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

RAW

  • Hero Member
  • *****
  • Posts: 794
@wp
Thanks, I cannot see any flicker anymore! Yeah, the SVN button and DOWNLOAD SNAPSHOT button ... I should have known ...  :)
// svn://svn.code.sf.net/p/lazarus-ccr/svn/components/callite/
This link didn't work for me, so I thought I use the 0.3.4 stable version ... This PC has no SVN software installed...

Is it possible that FBUFFER isn't freed ?
I get an Error about 11 unfreed Blocks, I'll take a look! Thanks again.

Edit: Looks like this is missing
Code: Pascal  [Select]
  1. destructor TCalDrawer.Destroy;
  2. begin
  3.   FBuffer.Free;
  4.   inherited Destroy;
  5. end;
« Last Edit: May 26, 2019, 09:55:11 pm by RAW »
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.4 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

wp

  • Hero Member
  • *****
  • Posts: 6158
Sorry for insufficient testing... The new commit fixes the memory leak. The link to the download of calendarlite.pas is ok: after opening the link you see the sourcecode of this unit - when you click on "Download this file" you get the pas file directly, just copy it over the original one of the 0.3.4 stable release.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10