Request to expose IsValidDataSource for override

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Liang
Newbie
Newbie
Posts: 22
Joined: Wed Jul 28, 2010 12:00 am

Request to expose IsValidDataSource for override

Post by Liang » Wed Aug 25, 2010 3:16 pm

Hello

I am now using BDS2006 C++Builder, with TeeChart 2010 Pro.

Currently, according to example, I need to define a new class derived from TDBChart with IsValidDataSource overridden to have some dataset hidden.

This is very complicated, according to demo, all must be programmed to be created run-time, and many coding work. And also I have headache for cross-unit datasets namespace problems.

Is it possible for TDBChart to expose this IsValidDataSource, so I can do in such a way to have an easy override?

1. Create a new event called OnValidDataSource to pass parameters out for user to further changing -->preferred
or
2. Directly expose the function address of IsValidDataSource for overriding.-->not perferred.

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

Re: Request to expose IsValidDataSource for override

Post by Yeray » Fri Aug 27, 2010 1:49 pm

Hi Liang,

I've added your request to the wish list to be studied for inclusion in next releases (TV52015116).
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

Liang
Newbie
Newbie
Posts: 22
Joined: Wed Jul 28, 2010 12:00 am

Re: Request to expose IsValidDataSource for override

Post by Liang » Wed Sep 15, 2010 1:14 pm

Hello

I have implemented such exposure of OnValidDataSource event. And it works fine.

Now I can make my software more clean, with only desired DataSet shown to user at run-time.

I would like to contribute my modification on DBChart.pas to you. Please check it:

line 48

Code: Select all

  TValidDataSourceEvent=Procedure(Sender:TCustomDBChart; ASeries:TChartSeries; AComponent:TComponent;
    var Valid:Boolean) of object;
line 57:

Code: Select all

    FOnValidDataSource:TValidDataSourceEvent;
line 91:

Code: Select all

    property OnValidDataSource:TValidDataSourceEvent read FOnValidDataSource
                                                 write FOnValidDataSource;
line 104:

Code: Select all

    property OnValidDataSource;
line 488:

Code: Select all

Function TCustomDBChart.IsValidDataSource(ASeries:TChartSeries; AComponent:TComponent):Boolean;
var
  BoolValue:Boolean;
Begin
  BoolValue:=inherited IsValidDataSource(ASeries,AComponent);
  if not BoolValue then BoolValue:=(AComponent is TDataSet) or (AComponent is TDataSource);
  if Assigned(FOnValidDataSource) then
  begin
    FOnValidDataSource(Self,ASeries,AComponent,BoolValue);
  end;
  Result:=BoolValue;
end;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Request to expose IsValidDataSource for override

Post by Narcís » Fri Sep 17, 2010 9:01 am

Hello Liang,

Thank you very much for your contribution. We will analyse it and get back to you as soon as possible.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Request to expose IsValidDataSource for override

Post by Narcís » Fri Sep 17, 2010 11:17 am

Hi Liang,

I think you can already override IsValidDataSource as in the examples in this thread. The projects Jørgen posted already derive a class from TDBChart and override IsValidDataSource method. Does this fit your needs?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Liang
Newbie
Newbie
Posts: 22
Joined: Wed Jul 28, 2010 12:00 am

Re: Request to expose IsValidDataSource for override

Post by Liang » Sun Sep 19, 2010 2:31 am

Hello

I think mine is different, and prefer my way.

My solution is to expose the event of ValildDataSource on the TDBChart level, so I can directly in my source code, catch this event from the TDBChart component, and override the result by user as

Code: Select all

 void __fastcall TScriptFrame::ResultDBChartValidDatasource(
      TCustomDBChart *Sender, TChartSeries *ASeries, TComponent *AComponent,
      bool &Valid)
{
  Valid=(AComponent==DataSource->DataSet);
}
//---------------------------------------------------------------------------
So the freedom is at the user side.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Request to expose IsValidDataSource for override

Post by Narcís » Wed Sep 22, 2010 8:02 am

Hi Liang,

Ok, we implemented this for next maintenance release.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply