Solved

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

Posted on 2000-02-24
14
1,118 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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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