File: unit3.pas

package info (click to toggle)
dozzaqueux 3.35-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,620 kB
  • ctags: 1,791
  • sloc: pascal: 34,605; xml: 961; makefile: 50; sh: 32
file content (214 lines) | stat: -rwxr-xr-x 5,080 bytes parent folder | download | duplicates (2)
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
{
Copyright 2005 Jean-Marie Biansan
 This file is part of Dozzzaqueux.

    Dozzzaqueux is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Dozzzaqueux is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Dozzzaqueux; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330,
    Boston, MA  02111-1307  USA }

unit Unit3;
 {$mode objfpc}{$H+}

interface

  uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Buttons,UChaines,UnitScaleFont,math,LCLType, ExtCtrls;

type

  { Tsaisienombremole }

  Tsaisienombremole = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Edit_quantite: TEdit;
    Label1: TLabel;
    Label_unite: TLabel;
    Memo1: TMemo;
    RadioGroup1: TRadioGroup;
    procedure BitBtn1Click(Sender: TObject);
    procedure Edit_quantiteKeyPress(Sender: TObject; var Key: char);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure RadioGroup1SelectionChanged(Sender: TObject);
  private
    { Dclarations prives }
    encreation:boolean;
  public
    { Dclarations publiques }
  end;

var
  saisienombremole: Tsaisienombremole;
nono,mama,nono1,mama1:float;
implementation

uses Unit1;



procedure Tsaisienombremole.BitBtn1Click(Sender: TObject);
var vbe,vbu:float;
begin
nono:=0;
mama:=0;
nono1:=0;
mama1:=0;
 try
 vbe:=strtofloat(form1.editvolume.text)/1000;
 except vbe:=volume_becher; end;
  try
 vbu:=strtofloat(form1.editvolume_burette.Text)/1000;
 except vbu:=volume_burette_max;   end;
 if vbe>0 then   volume_becher:=vbe;
 if vbu>0 then   volume_burette_max:=vbu;

 if edit_quantite.Text='' then
 begin
 application.MessageBox(pchar(Format(rsPasDeValeurE, ['"', '"'])),
 pchar(rsAttention2), mb_ok);
 modalresult:=mrretry;
 exit;
 end;


case radiogroup1.ItemIndex of
1:begin
try
nono:=strtofloat(edit_quantite.Text);
except
application.MessageBox(pchar(rsFormatDeVale),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
if nono<=0 then begin
application.MessageBox(pchar(rsLeNombreDeMo),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
end;



2: begin
try
mama:=strtofloat(edit_quantite.Text);
except
application.MessageBox(pchar(rsFormatDeVale2),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
if mama<=0 then begin
application.MessageBox(pchar(rsLaMasseDoitT),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
end;


0: begin
try
nono1:=strtofloat(edit_quantite.Text);
except
application.MessageBox(pchar(rsFormatDeVale3),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
if nono1<=0 then begin
application.MessageBox(pchar(rsLeNombreDeMo),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
end;


3: begin
try
mama1:=strtofloat(edit_quantite.Text);
except
application.MessageBox(pchar(rsFormatDeVale2),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
if mama1<=0 then begin
application.MessageBox(pchar(rsLaMasseDoitT),
pchar(rsAttention2), mb_ok);
modalresult:=mrretry;
exit;
end;
end;
end;



end;

procedure Tsaisienombremole.Edit_quantiteKeyPress(Sender: TObject; var Key: char
  );
begin
    if key=',' then key:='.';
end;

procedure Tsaisienombremole.FormCreate(Sender: TObject);
begin

   encreation:=true;
  Caption := rsNombreDeMole2 ;

       Label_unite.Caption := rsLaQuantitDeM ;

                BitBtn1.Caption := rsOK ;
              BitBtn2.Caption := rsAnnuler ;
              radiogroup1.Items.Clear;
              radiogroup1.Items.Add(rsLaQuantitDeM2);
              radiogroup1.Items.Add(rsLaQuantitDeM);
              radiogroup1.Items.Add(rsLaMasse);
              radiogroup1.Items.Add(rsLaMasseParLD);
              radiogroup1.ItemIndex:=0;
              label_unite.Caption:=rsMolL;
     memo1.Lines.Clear;
     memo1.Lines.Add(rsAttentionLeV);
     memo1.Lines.Add(rsAinsiSiLeVol);
     memo1.Lines.Add(rsLaConcentrat);
     memo1.Lines.Add(rsSiVousSaisis);
end;

procedure Tsaisienombremole.FormShow(Sender: TObject);
begin
  //if encreation then begin scalefont(self); encreation:=false; end;
  edit_quantite.SetFocus;
end;

procedure Tsaisienombremole.RadioGroup1SelectionChanged(Sender: TObject);
begin
  case  RadioGroup1.ItemIndex of
  0: label_unite.Caption:=rsMolL;
  1: label_unite.Caption:=rsMol;
  2:label_unite.Caption:=rsG;
  3: label_unite.Caption:=rsGL;
  end;
end;


initialization
  {$I unit3.lrs}
end.