?
Solved

Exposing "Edit chart..." in a TChart wrapper...

Posted on 2000-02-24
14
Medium Priority
?
1,141 Views
Last Modified: 2010-05-18
Hi all,

i´m writting a component that is a Panel with a TChart, a ToolBar and some buttons inside.

The TChart´s owner is the component (TPanel descendant) itself, but I would like to allow the users to use the "Edit chart" feature like when right-clicking in the TChart component.

I think I have to create and register a component editor to my component and writ some code in ExecuteVerb method, but what code would  call TChart component editor.

I´m using D4 C/S.

TIA,
Itamar
0
Comment
Question by:itamar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 400 total points
ID: 2555160
Hi itamar,

It's simple :

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses EditChar;   <---------------------!!!!
{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
EditChart(Self,Chart1 );  
end;

end.


---

(if you use DBChart components)


 Uses DBEditCh;
 EditChart(Self,DBChart1 );

Regards, Zif.
0
 
LVL 4

Author Comment

by:itamar
ID: 2555380
Hi zif !

thanks for the fast response. In fact I will expose it in design-time. But the main code is here in your answer.

Regards,
Itamar
0
 
LVL 4

Author Comment

by:itamar
ID: 2555418
Hi Zif.

I graded your answer before testing it ! Now, I got the message "File not found: IEdiSeri.dcu"

Any ideas ???

[]´s
Itamar
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:ZifNab
ID: 2555510
strange, I tried it out on D4 on my office and it worked. Can you give me your source-code?
0
 
LVL 4

Author Comment

by:itamar
ID: 2555594
Hi Zif,

It´s a copy & Paste of your code. Perhaps the problem is Delphi version.


My version is 4.0 (Build 5.104) Update Pack 2.

Your version is the same ?

Itamar
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2555808
I've the D4 Pro version update 3
(build 5.108)

I also have the Pro TeeChart installed. But this should be normal the same as with the standard components. Because the extra components (of the Pro version) are placed on another tab.

Don't you have the missing file installed in the lib directory of delphi?


Zif.
0
 
LVL 4

Author Comment

by:itamar
ID: 2558248
Zif,

i´ve downloaded the newest version of TChart and everything is working fine now.

Thanks,

Itamar
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2564188
Great!
0
 
LVL 4

Author Comment

by:itamar
ID: 2573717
Hi ZIF !

it´s me again !

I told you everything was working fine, well, I lied ;)))

In fact, the Chart editor is starting, but when I add a serie, the editor doesn´t "write" the Series1 declaration in source code as it usually does outside of my component. I´d really apreciate if you could help me further. I´m really stucked in this problem.

I can send a simple (not) working example of my component.

TIA,
Itamar
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2602727
Hi itamar,

just send the example over and I'll look what I can do,

Zif.
0
 
LVL 4

Author Comment

by:itamar
ID: 2604893
Hi Zif,

this is an example of my component:

>>>>>>

unit UTest;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, ToolWin, ComCtrls, ExtCtrls, ImgList, stdCtrls, Spin, teeprevi,
  chart, series, DsgnIntf, EditChar;

type
    TTestEditor = class(TComponentEditor)
       function GetVerbCount: integer; override;
       function GetVerb(index: integer): string; override;
       procedure ExecuteVerb(Index: integer); override;
       procedure Edit; override;
    end;

type
  TTest = class(TPanel)
  private
    IPBarra     : TToolBar;
    btnTest : TToolButton;
    procedure TestClick( Sender: TObject );
  protected
    { Protected declarations }
  public
    grfGraf     : TChart;
    constructor Create(AOwner: TComponent); override;
    destructor destroy; override;
  published
    { Published declarations }
  end;

procedure Register;

implementation

{$R *.res}

procedure Register;
begin
     RegisterComponents('itamar', [TTest]);
     RegisterComponentEditor(TTest, TTestEditor);
end;

constructor TTest.Create(AOwner : TComponent);
begin
     inherited Create (AOwner);

     Self.Parent := TWinControl(AOwner);
     grfGraf     := TChart.Create(Self);
     IPBarra     := TToolBar.Create(Self);
     btnTest     := TToolButton.Create(Self);

     grfGraf.Parent       := Self;
     grfGraf.Align        := alClient;

     IPBarra.Parent      := Self;
     IPBarra.EdgeBorders := [ebTop, ebBottom];

     btnTest.Parent     := IPBarra;
     btnTest.Name       := 'btnTest';
     btnTest.Hint       := 'Test';
     btnTest.Left       := 0;
     btnTest.ImageIndex := 0;
     btnTest.ShowHint   := True;
     btnTest.OnClick    := TestClick;
end;

destructor TTest.destroy;
begin
     inherited;
end;

procedure TTest.TestClick( Sender: TObject );
begin
   Self.grfGraf.View3D := not Self.grfGraf.View3D;
end ;


{ //////  TTestEditor ///////}

procedure TTestEditor.Edit;
begin
   ExecuteVerb(0);
end;

procedure TTestEditor.ExecuteVerb(Index: integer);
begin
   case Index of
      0: begin
            EditChart(TForm(Component.Owner), TCustomChart(TTest(Component).grfGraf));
            Designer.Modified;
         end;
   end;
end;

function TTestEditor.GetVerb(index: integer): string;
begin
   case index of
      0: Result := 'Editar grafico';
   end;
end;

function TTestEditor.GetVerbCount: integer;
begin
     Result := 1;
end;

end.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2617080
sorry itamar, I'm stuck at the moment too.
0
 

Expert Comment

by:Saxon
ID: 2867609
I´ve got the same prob as you. The solution of Zif seems simple but doesn´t work, because I get the fatal compiler error: file not found: IEditCha.dcu (regarding EditChar in the uses part)
Do you know, whats the rason for it?
I´m using D5 with TeeChart Pro 4.02
Thx
0
 

Expert Comment

by:nezeqcat
ID: 7278239
About IEditCha.dcu. May be someone will need it:
The IEditCha.dcu is part of Runtime package TEEUI50.BPL
In order to resolve problem "I get the fatal compiler error: file not found: IEditCha.dcu" add it to application this way:
To use a custom runtime package with an application, choose Project|Options and add the name of the package (TEEUI50) to the Runtime Packages edit box on the Packages page.
Now you can enjoy the Tee Chart Editor
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question