dfm Property

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
tultalk
Newbie
Newbie
Posts: 13
Joined: Wed Mar 20, 2019 12:00 am

dfm Property

Post by tultalk » Wed Apr 03, 2019 3:15 pm

Hi:

.dfm shows DefaultCanvas := 'TGDIPlusCanvas';

TChart has no such property as DefaultCanvas but only a DelphiCanvas.

Why doesn't this pop up an error?

Thanks

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: dfm Property

Post by Yeray » Thu Apr 04, 2019 8:00 am

Hello,

There's a private property in TCustomTeePanel named IDefaultCanvas. And at TCustomTeePanel.Create constructor you'll find this to use the value from the registry:

Code: Select all

Constructor TCustomTeePanel.Create(AOwner: TComponent);
begin
  inherited;
  //...
  
  // For new charts, set default canvas whatever is at the Registry,
  // or use the class indicated by TeeDefaultCanvas global variable,
  // which is (in VCL) the GDI+ canvas by default.

  // Setting TeeDefaultCanvas:='' will not look at registry, and will not
  // use VCL GDI+

  if (TeeDefaultCanvas<>'') and
     (not (csLoading in ComponentState)) then
     IDefaultCanvas:=TeeReadStringOption('DefaultCanvas',TeeDefaultCanvas)
  else
     IDefaultCanvas:=''; // Existing old charts saved in dfm/fmx, no change

  CreateDefaultCanvas;
  //...
end;
Then, to read the DefaultCanvas property from the dfm we use this:

Code: Select all

Procedure TCustomTeePanel.DefineProperties(Filer:TFiler);

  function DoWriteDefaultCanvas:Boolean;
  begin
    result:=(Filer.Ancestor=nil) or
            (IDefaultCanvas<>TCustomTeePanel(Filer.Ancestor).IDefaultCanvas);
  end;

begin
  inherited;

  //...
  Filer.DefineProperty('DefaultCanvas',ReadDefaultCanvas,WriteDefaultCanvas,
        {$IFDEF FMX}False{$ELSE}DoWriteDefaultCanvas{$ENDIF});
end;

procedure TCustomTeePanel.ReadDefaultCanvas(Reader: TReader);
begin
  IDefaultCanvas:=Reader.ReadString;
  {$IFDEF FMX}
  IDefaultCanvas:=''; // Switching canvas is not supported yet in FireMonkey
  {$ENDIF}
end;
I hope this explains your doubt.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply