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

interface

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

type
  Tdialogscaladdform = class(TForm)
    Label2: TLabel;
    spectre3: TComboBox;
    calculer: TButton;
    annuler: TButton;
    Panel1: TPanel;
    spectre1: TComboBox;
    operation: TComboBox;
    scalarBox: TEditReal;
    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
  dialogscaladdform: Tdialogscaladdform;

implementation

{$R *.DFM}

{******************************************
}
procedure Tdialogscaladdform.spectre1DropDown(Sender: TObject);
var i:integer;
begin
{initialisation a chaque ouverture des items des spectres}
spectre1.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);
       spectre3.items.add(deuxd.spect[i].nom);
       end;
end;

{************************************
détruit la fiche}
procedure Tdialogscaladdform.annulerClick(Sender: TObject);
begin
dialogscaladdform.close;
end;
{************************************
effectue l'operation}
procedure Tdialogscaladdform.calculerClick(Sender: TObject);
begin
if operation.text='+' then
   deuxd.scaladd(scalarBox.value,spectre1.text,spectre3.text);{nom3=nom2+nom1}
if operation.text='-' then
   deuxd.scalSub(scalarBox.value,spectre1.text,spectre3.text);{nom3=nom2+nom1}
if operation.text='*' then
   deuxd.scalMult(scalarBox.value,spectre1.text,spectre3.text);{nom3=nom2+nom1}
if operation.text='/' then
   deuxd.scalDiv(scalarBox.value,spectre1.text,spectre3.text);{nom3=nom2+nom1}

{dialogscaladdform.close; }
end;

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

end.
