home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Chart_EditorPanel.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  2.5 KB  |  90 lines

  1. {$I TeeDefs.inc}
  2. unit Chart_EditorPanel;
  3.  
  4. interface
  5.  
  6. uses
  7.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  8.   Base, TeeEdit, ExtCtrls, TeeProcs, TeEngine, Chart, StdCtrls, Series,
  9.   TeeTools, ComCtrls;
  10.  
  11. type
  12.   TChartEditorPanelForm = class(TBaseForm)
  13.     ChartEditorPanel1: TChartEditorPanel;
  14.     Series1: THorizLineSeries;
  15.     Splitter1: TSplitter;
  16.     Label1: TLabel;
  17.     ComboBox1: TComboBox;
  18.     Label2: TLabel;
  19.     ComboBox2: TComboBox;
  20.     ChartTool1: TMarksTipTool;
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure ComboBox1Change(Sender: TObject);
  23.     procedure ComboBox2Change(Sender: TObject);
  24.     procedure Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  25.       Shift: TShiftState; X, Y: Integer);
  26.     procedure FormShow(Sender: TObject);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TChartEditorPanelForm.FormCreate(Sender: TObject);
  38. begin
  39.   inherited;
  40.   Series1.FillSampleValues(10);
  41. end;
  42.  
  43. procedure TChartEditorPanelForm.ComboBox1Change(Sender: TObject);
  44. begin
  45.   { change the tabs position }
  46.   With ChartEditorPanel1.Editor.MainPage do
  47.   Case ComboBox1.ItemIndex of
  48.     0: TabPosition:=tpTop;
  49.     1: begin {$IFDEF D4}Style:=tsTabs;{$ENDIF} TabPosition:=tpBottom; end;
  50.     2: begin {$IFDEF D4}Style:=tsTabs; TabPosition:=tpLeft;{$ENDIF} end;
  51.     3: begin {$IFDEF D4}Style:=tsTabs; TabPosition:=tpRight;{$ENDIF} end;
  52.   end;
  53. end;
  54.  
  55. procedure TChartEditorPanelForm.ComboBox2Change(Sender: TObject);
  56. begin
  57.   { change the tabs style }
  58.   With ChartEditorPanel1.Editor.MainPage do
  59.   Case ComboBox2.ItemIndex of
  60.     0: {$IFDEF D4}Style:=tsTabs{$ENDIF};
  61.     1: begin TabPosition:=tpTop; {$IFDEF D4}Style:=tsButtons;{$ENDIF} end;
  62.     2: begin TabPosition:=tpTop; {$IFDEF D4}Style:=tsFlatButtons;{$ENDIF} end;
  63.   end;
  64. end;
  65.  
  66. procedure TChartEditorPanelForm.Chart1MouseDown(Sender: TObject;
  67.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  68. begin
  69.   { On mouse down, show the appropiate tab in the editor... }
  70.   ChartEditorPanel1.SelectUnderMouse;
  71. end;
  72.  
  73. procedure TChartEditorPanelForm.FormShow(Sender: TObject);
  74. begin
  75.   inherited;
  76.   ComboBox1.ItemIndex:=0;
  77.   ComboBox2.ItemIndex:=0;
  78.  
  79.   {$IFNDEF D4}  { Delphi 3 does not support tab styles }
  80.   ComboBox2.Visible:=False;
  81.   Label2.Visible:=False;
  82.   ComboBox1.Items.Delete(3);
  83.   ComboBox1.Items.Delete(2);
  84.   {$ENDIF}
  85. end;
  86.  
  87. initialization
  88.   RegisterClass(TChartEditorPanelForm);
  89. end.
  90.