unit dialogAddSpectrum;
{dialog addition/soustraction spectres deux D}
{ MODIFICATIONS                                                                     }

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, editdata, ExtCtrls;

type
  Tdialogaddform = class(TForm)
    Label2: TLabel;
    spectre3: TComboBox;
    calculer: TButton;
    annuler: TButton;
    Panel1: TPanel;
    spectre1: TComboBox;
    spectre2: TComboBox;
    operation: TComboBox;
    procedure spectre1DropDown(Sender: TObject);
    procedure annulerClick(Sender: TObject);
    procedure calculerClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Déclarations privées}
  public
    { Déclarations publiques}
  end;

var
  dialogaddform: Tdialogaddform;

implementation

{$R *.DFM}

{******************************************
}
procedure Tdialogaddform.spectre1DropDown(Sender: TObject);
var i:integer;
begin
{initialisation a chaque ouverture des items des spectres}
spectre1.items.clear;
spectre2.items.clear;
spectre3.items.clear;

for i:=1 to totalspectre do
    if deuxd.spect[i]<>nil then
       begin
       spectre1.items.add(deuxd.spect[i].nom);
       spectre2.items.add(deuxd.spect[i].nom);
       spectre3.items.add(deuxd.spect[i].nom);
       end;

end;

{************************************
détruit la fiche}
procedure Tdialogaddform.annulerClick(Sender: TObject);
begin
dialogaddform.close;
end;
{************************************
effectue l'operation}
procedure Tdialogaddform.calculerClick(Sender: TObject);
begin
if operation.text='+' then
   deuxd.addition(spectre1.text,spectre2.text,spectre3.text);{nom3=nom2+nom1}

if operation.text='-' then
   deuxd.soustraction(spectre1.text,spectre2.text,spectre3.text);{nom3=nom1-nom2}

if operation.text='*' then
   deuxd.Multiplication(spectre1.text,spectre2.text,spectre3.text);{nom3=nom1*nom2}

if operation.text='/' then
   deuxd.Division(spectre1.text,spectre2.text,spectre3.text);{nom3=nom1/nom2}

{dialogaddform.close; }
end;

procedure Tdialogaddform.FormCreate(Sender: TObject);
begin
  left:=0;top:=0;width:=230;height:=228;
     WindowState:=wsMinimized;        
end;

end.
