1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
unit Unit19;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Spin, ExtCtrls, Buttons,UChaines,UnitScaleFont,math,LCLType;
type
{ Tsaisiefaisceau }
Tsaisiefaisceau = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ColorDialog1: TColorDialog;
Editgeometriquepas: TEdit;
Editgeometriquex1: TEdit;
editlineairepas: TEdit;
Editlineairex1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
ListBox1: TListBox;
Panel1: TPanel;
RadioGrouptypefaisceau: TRadioGroup;
SpinEdit1: TSpinEdit;
procedure BitBtn1Click(Sender: TObject);
procedure EditgeometriquepasKeyPress(Sender: TObject; var Key: char);
procedure Editgeometriquex1KeyPress(Sender: TObject; var Key: char);
procedure editlineairepasKeyPress(Sender: TObject; var Key: char);
procedure Editlineairex1KeyPress(Sender: TObject; var Key: char);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Panel1Click(Sender: TObject);
private
{ private declarations }
encreation:boolean;
public
{ public declarations }
end;
var
saisiefaisceau: Tsaisiefaisceau;
premiere_valeur,derniere_valeur:float;
indice_valeur_a_modifier:integer;
couleur_limite_degrade:tcolor;
implementation
uses Unit1;
{ Tsaisiefaisceau }
procedure Tsaisiefaisceau.BitBtn1Click(Sender: TObject);
var i:integer; zzz:string;
begin
nombre_valeurs_faisceau:=0;
setlength(liste_valeurs_faisceau,0);
if listbox1.ItemIndex=-1 then begin
application.MessageBox(pchar(rsPasDeGrandeu),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
indice_valeur_a_modifier:=listbox1.ItemIndex;
case RadioGrouptypefaisceau.ItemIndex of
0: begin
try
strtofloat(editlineairex1.Text);
except
application.MessageBox(pchar(rsSyntaxeDeVal),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
try
strtofloat(editlineairepas.Text);
except
application.MessageBox(pchar(rsSyntaxeDeVal),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
if editlineairepas.Text='0' then begin
application.MessageBox(pchar(rsValeurDePasN),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
nombre_valeurs_faisceau:=spinedit1.Value;
premiere_valeur:= strtofloat(editlineairex1.Text);
derniere_valeur:= strtofloat(editlineairex1.Text)+
(nombre_valeurs_faisceau-1)*strtofloat(editlineairepas.text);
if ((listbox1.ItemIndex<=1+form1.stringgridreactifs_becher.rowcount-1+
form1.stringgridreactifs_burette.rowcount-1)) then
if ((premiere_valeur<0) or (derniere_valeur<0)) then begin
application.MessageBox(pchar(rsCelaConduira),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
nombre_valeurs_faisceau:=spinedit1.Value;
setlength(liste_valeurs_faisceau,nombre_valeurs_faisceau);
for i:=1 to nombre_valeurs_faisceau do
liste_valeurs_faisceau[i-1]:=
strtofloat(editlineairex1.text)+(i-1)*strtofloat(editlineairepas.text);
end; {du cas lineaire}
1: begin
try
strtofloat(editgeometriquex1.Text);
except
application.MessageBox(pchar(rsSyntaxeDeVal),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
try
strtofloat(editgeometriquepas.Text);
except
application.MessageBox(pchar(rsSyntaxeDeVal),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
if ((strtofloat(editgeometriquepas.Text)<=0) or
(strtofloat(editgeometriquepas.Text)=1)) then begin
application.MessageBox(pchar(rsValeurDePas0),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
if ((listbox1.ItemIndex<=1+form1.stringgridreactifs_becher.rowcount-1+
form1.stringgridreactifs_burette.rowcount-1)) then
if (strtofloat(editgeometriquex1.Text)<=0) then begin
application.MessageBox(pchar(rsConcentratio4),
pchar(rsHLas), mb_ok);
modalresult:=mrcancel;
exit;
end;
nombre_valeurs_faisceau:=spinedit1.Value;
setlength(liste_valeurs_faisceau,nombre_valeurs_faisceau);
liste_valeurs_faisceau[0]:=strtofloat(editgeometriquex1.text);
for i:=2 to nombre_valeurs_faisceau do
liste_valeurs_faisceau[i-1]:=liste_valeurs_faisceau[i-2]
*strtofloat(editgeometriquepas.text);
end; {du cas geometrique}
end;{du case}
end;
procedure Tsaisiefaisceau.EditgeometriquepasKeyPress(Sender: TObject;
var Key: char);
begin
if key=',' then key:='.';
end;
procedure Tsaisiefaisceau.Editgeometriquex1KeyPress(Sender: TObject;
var Key: char);
begin
if key=',' then key:='.';
end;
procedure Tsaisiefaisceau.editlineairepasKeyPress(Sender: TObject; var Key: char
);
begin
if key=',' then key:='.';
end;
procedure Tsaisiefaisceau.Editlineairex1KeyPress(Sender: TObject; var Key: char
);
begin
if key=',' then key:='.';
end;
procedure Tsaisiefaisceau.FormCreate(Sender: TObject);
begin
encreation:=true;
Caption := rsFaisceauDeCo;
Label1.Caption := rsGrandeurFair;
Label2.Caption := rsPourObtenirL2;
Label4.Caption := rs1ReValeur;
Label5.Caption := rsIncrMent;
Label6.Caption := rs1ReValeur;
Label7.Caption := rsPas;
Label8.Caption := rsLesCouleursE;
RadioGrouptypefaisceau.Caption := rsTypeDeSuiteD;
//RadioGrouptypefaisceau.Items.Clear;
RadioGrouptypefaisceau.Items[0]:=(rsArithmTique);
RadioGrouptypefaisceau.Items[1]:=(rsGOmTrique);
BitBtn1.Caption := rsOK;
BitBtn2.Caption := rsAnnuler;
end;
procedure Tsaisiefaisceau.FormShow(Sender: TObject);
begin
// if encreation then begin scalefont(self); encreation:=false; end;
end;
procedure Tsaisiefaisceau.Panel1Click(Sender: TObject);
begin
colordialog1.Color:=panel1.Color;
colordialog1.Execute;
panel1.Color:=colordialog1.Color;
couleur_limite_degrade:=panel1.Color;
end;
initialization
{$I unit19.lrs}
end.
|