2

This may be an embarcadero VCL problem, but using the latest Delphi (10.4.1) I came across the following problem. I am use to set DoubleBuffering to true in the FormCreate, but noted that this creates a painting issue of the panels when:

  1. the panel is located inside of a groupbox
  2. a Radiobutton is added to the panel

in below image it can be seen that once DoubleBuffering is set to true, the painting of the panels get 'messed-up'.

DoubleBuffering with styles From left to right, Windows, Cyan Dusk and Cyan Dusk with DoubleBuffering.

My question is, do other users encounter similar issues, or am I missing something here?

Source code of this model (incl. DoubleBuffering) is quite basic:


unit Test_GB_Main;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton7: TRadioButton;
    RadioButton8: TRadioButton;

    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin
  DoubleBuffered := True ;   // to avoid flickering
end;


end.

Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
  • Do you still have the same problem if you set `DoubleBuffered := True` already at design time? – Tom Brunberg Dec 22 '20 at 12:51
  • Why don't you set DoubleBuffering False? Setting it True has always been problematic. – David Heffernan Dec 22 '20 at 12:57
  • 2
    Is it just me or is this the one millionth question this year that says "*if I use VCL styles*, some bugs happen"? – Andreas Rejbrand Dec 22 '20 at 13:12
  • 1
    @AndreasRejbrand Your observation is correct. Using VCL Styles is a good option if you feel like you have too much hair and you want to pull some out, otherwise not so much. – Dalija Prasnikar Dec 22 '20 at 14:16
  • @TomBruberg Using the Object Inspector to set the Double Buffered has the same effect as doing it in run time. Turning it off, as David suggested, will indeed help me out in this case, but merely confirms that the VCL (with styles) has issues. – HP van Rossen Dec 22 '20 at 16:24
  • Ok, it was just a thought. I don't have 10.4, but tried your case anyway in 10.1 and I did not see the problem. In case you make a quality report to Emba you could mention it. – Tom Brunberg Dec 22 '20 at 17:31
  • It appears Embarcadero that while adding ability to chose separate style for separate controls Embarcadero screwed something up as I have seen several questions about people having difficulties using VCL styles in Delphi 10.4 but none of tem could be reproduced in Delphi 10.3. – SilverWarior Dec 23 '20 at 06:38
  • @All. Thanks for the feedback. I made a bug report to Embarcadero and hope they will take care of it in a future release. – HP van Rossen Dec 23 '20 at 09:16
  • They'll no doubt fix this problem, and introduce a new one at the same time. Seems like even after all these years they can't make a version of Delphi with reliable styles. – David Heffernan Dec 24 '20 at 08:52

0 Answers0