Exception on the event OnGetAxisLabel

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Exception on the event OnGetAxisLabel

Post by franckgar » Tue Mar 07, 2006 8:53 am

hi,
I try to use the event OnGetAxisLabel in my application, but when this event is generated an exception is raised when I try to read the string "LabelText".
I found the problem : in my project options I'm not using the option "huge strings", which corresponds to {$H-}.
how can I bypass this problem ?
Thanks

Franck

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

Post by Narcís » Tue Mar 07, 2006 9:35 am

Hi Franck,

I've been able to reproduce that. TeeChart needs "Huge Strings" so to work it around you can do something like the code below forcing the use of "Huge Strings" before executing the GetAxisLabel event.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    {$H+}
    procedure Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
      ValueIndex: Integer; var LabelText: String);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  LabelText:='abc';
end;

end.
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

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Tue Mar 07, 2006 9:55 am

What do you mean exactly by "TeeChart needs Huge Strings" ?
In my application I definitively can not set "huge strings" option in the project options of the application, does it mean that TeeChart will not work correctly without this option ?
What problems will I encounter ?

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

Post by Narcís » Tue Mar 07, 2006 10:03 am

Hi Franck,

TeeChart needs "Huge Strings" because it uses several PChar castings. If you disable "Huge Strings" your application with TeeChart may not run, depending on the features you use. However, you can enable/disable "Huge Strings" doing something like this:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    procedure Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
      ValueIndex: Integer; var LabelText: {$H+}String{$H-});
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: {$H+}String{$H-});
begin
  LabelText:='abc';
end;

end.
However, not using "Huge Strings" may lead you to several other problems in Delphi. Our suggestion is to do the opposite, disable them when you don't want to use them.
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