Solved

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

Posted on 2000-02-24
14
1,082 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
14 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Hi Zif.

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

Any ideas ???

[]´s
Itamar
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Zif,

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

Thanks,

Itamar
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Great!
0
 
LVL 4

Author Comment

by:itamar
Comment Utility
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
Comment Utility
Hi itamar,

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

Zif.
0
 
LVL 4

Author Comment

by:itamar
Comment Utility
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
Comment Utility
sorry itamar, I'm stuck at the moment too.
0
 

Expert Comment

by:Saxon
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now