A jescze mam taki problem, którego nie mogę rozwiązać, otóż mam taki kod programu:
Kopiuj
unit Form2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ButtonGroup, jpeg, ExtCtrls;
type
Tf2 = class(TForm)
o4: TEdit;
r4: TEdit;
o5: TEdit;
r5: TEdit;
s1: TEdit;
Button1: TButton;
o3: TEdit;
r3: TEdit;
o2: TEdit;
r2: TEdit;
o1: TEdit;
r1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
o6: TEdit;
r6: TEdit;
o7: TEdit;
r7: TEdit;
o8: TEdit;
r8: TEdit;
o9: TEdit;
r9: TEdit;
o10: TEdit;
r10: TEdit;
Label4: TLabel;
oc: TEdit;
ListBox1: TListBox;
ListBox2: TListBox;
ListBox3: TListBox;
ListBox4: TListBox;
ListBox5: TListBox;
ListBox6: TListBox;
ListBox7: TListBox;
ListBox8: TListBox;
ListBox9: TListBox;
ListBox10: TListBox;
BitBtn1: TBitBtn;
Label5: TLabel;
RadioButton1: TRadioButton;
RadioButton: TRadioButton;
Image1: TImage;
Button2: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListBox2Click(Sender: TObject);
procedure ListBox3Click(Sender: TObject);
procedure ListBox4Click(Sender: TObject);
procedure ListBox5Click(Sender: TObject);
procedure ListBox6Click(Sender: TObject);
procedure ListBox7Click(Sender: TObject);
procedure ListBox8Click(Sender: TObject);
procedure ListBox9Click(Sender: TObject);
procedure ListBox10Click(Sender: TObject);
procedure s1Change(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButtonClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
f2: Tf2;
implementation
{$R *.dfm}
procedure Tf2.Button1Click(Sender: TObject);
var
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, R, S, T, U : Extended;
begin
A := StrToFloat(o1.text);
B := StrtoFloat(o2.text);
C := StrtoFloat(o3.text);
D := StrtoFloat(o4.text);
E := StrtoFloat(o5.text);
F := StrtoFloat(o6.text);
G := StrtoFloat(o7.text);
H := StrtoFloat(o8.text);
I := StrtoFloat(o9.text);
J := StrtoFloat(o10.text);
K := StrtoFloat(r1.text);
L := StrtoFloat(r2.text);
M := StrtoFloat(r3.text);
N := StrtoFloat(r4.text);
O := StrtoFloat(r6.text);
P := StrtoFloat(r7.text);
R := StrtoFloat(r8.text);
S := StrtoFloat(r9.text);
T := StrtoFloat(r10.text);
U := (A*K + B*L + C*M + D*N + F*O + G*P + H*R + I*S + J*T) / (K+L+M+N+O+P+R+S+T) ;
s1.Text := FloattoStr(U)
end;
procedure Tf2.Button2Click(Sender: TObject);
var
MS : TMemoryStream;
begin
MS := TMemoryStream.Create;
MS.WriteComponent(o1);
MS.WriteComponent(o2);
MS.WriteComponent(o3);
MS.WriteComponent(o4);
MS.WriteComponent(o5);
MS.WriteComponent(o6);
MS.WriteComponent(o7);
MS.WriteComponent(o8);
MS.WriteComponent(o9);
MS.WriteComponent(o10);
MS.WriteComponent(r1);
MS.WriteComponent(r2);
MS.WriteComponent(r3);
MS.WriteComponent(r4);
MS.WriteComponent(r5);
MS.WriteComponent(r6);
MS.WriteComponent(r7);
MS.WriteComponent(r8);
MS.WriteComponent(r9);
MS.WriteComponent(r10);
MS.SaveToFile('E:\test.bin');
MS.Free;
end;
procedure Tf2.Edit1Change(Sender: TObject);
begin
**if (Edit1.Text) = '3+' then O1.Text := '3.6' else O1.Text := '0' ;**__foo__
end;
procedure Tf2.ListBox10Click(Sender: TObject);
begin
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'kartkówka' then r10.Text := '3';
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'klasówka' then r10.Text := '4';
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'praca na lekcji' then r10.Text := '2';
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'zadanie' then r10.Text := '2';
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'odpowiedź' then r10.Text := '3';
if Listbox10.Items.Strings[Listbox10.ItemIndex] = 'projekt' then r10.Text := '2';
end;
procedure Tf2.ListBox1Click(Sender: TObject);
begin
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'kartkówka' then r1.Text := '3';
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'klasówka' then r1.Text := '4';
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'praca na lekcji' then r1.Text := '2';
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'zadanie' then r1.Text := '2';
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'odpowiedź' then r1.Text := '3';
if Listbox1.Items.Strings[Listbox1.ItemIndex] = 'projekt' then r1.Text := '2';
end;
procedure Tf2.ListBox2Click(Sender: TObject);
begin
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'kartkówka' then r2.Text := '3';
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'klasówka' then r2.Text := '4';
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'praca na lekcji' then r2.Text := '2';
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'zadanie' then r2.Text := '2';
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'odpowiedź' then r2.Text := '3';
if Listbox2.Items.Strings[Listbox2.ItemIndex] = 'projekt' then r2.Text := '2';
end;
procedure Tf2.ListBox3Click(Sender: TObject);
begin
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'kartkówka' then r3.Text := '3';
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'klasówka' then r3.Text := '4';
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'praca na lekcji' then r3.Text := '2';
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'zadanie' then r3.Text := '2';
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'odpowiedź' then r3.Text := '3';
if Listbox3.Items.Strings[Listbox3.ItemIndex] = 'projekt' then r3.Text := '2';
end;
procedure Tf2.ListBox4Click(Sender: TObject);
begin
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'kartkówka' then r4.Text := '3';
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'klasówka' then r4.Text := '4';
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'praca na lekcji' then r4.Text := '2';
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'zadanie' then r4.Text := '2';
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'odpowiedź' then r4.Text := '3';
if Listbox4.Items.Strings[Listbox4.ItemIndex] = 'projekt' then r4.Text := '2';
end;
procedure Tf2.ListBox5Click(Sender: TObject);
begin
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'kartkówka' then r5.Text := '3';
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'klasówka' then r5.Text := '4';
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'praca na lekcji' then r5.Text := '2';
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'zadanie' then r5.Text := '2';
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'odpowiedź' then r5.Text := '3';
if Listbox5.Items.Strings[Listbox5.ItemIndex] = 'projekt' then r5.Text := '2';
end;
procedure Tf2.ListBox6Click(Sender: TObject);
begin
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'kartkówka' then r6.Text := '3';
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'klasówka' then r6.Text := '4';
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'praca na lekcji' then r6.Text := '2';
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'zadanie' then r6.Text := '2';
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'odpowiedź' then r6.Text := '3';
if Listbox6.Items.Strings[Listbox6.ItemIndex] = 'projekt' then r6.Text := '2';
end;
procedure Tf2.ListBox7Click(Sender: TObject);
begin
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'kartkówka' then r7.Text := '3';
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'klasówka' then r7.Text := '4';
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'praca na lekcji' then r7.Text := '2';
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'zadanie' then r7.Text := '2';
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'odpowiedź' then r7.Text := '3';
if Listbox7.Items.Strings[Listbox7.ItemIndex] = 'projekt' then r7.Text := '2';
end;
procedure Tf2.ListBox8Click(Sender: TObject);
begin
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'kartkówka' then r8.Text := '3';
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'klasówka' then r8.Text := '4';
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'praca na lekcji' then r8.Text := '2';
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'zadanie' then r8.Text := '2';
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'odpowiedź' then r8.Text := '3';
if Listbox8.Items.Strings[Listbox8.ItemIndex] = 'projekt' then r8.Text := '2';
end;
procedure Tf2.ListBox9Click(Sender: TObject);
begin
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'kartkówka' then r9.Text := '3';
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'klasówka' then r9.Text := '4';
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'praca na lekcji' then r9.Text := '2';
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'zadanie' then r9.Text := '2';
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'odpowiedź' then r9.Text := '3';
if Listbox9.Items.Strings[Listbox9.ItemIndex] = 'projekt' then r9.Text := '2';
end;
procedure Tf2.RadioButton1Click(Sender: TObject);
begin
if true then r1.Visible := true;
if true then r2.Visible := true;
if true then r3.Visible := true;
if true then r4.Visible := true;
if true then r5.Visible := true;
if true then r6.Visible := true;
if true then r7.Visible := true;
if true then r8.Visible := true;
if true then r9.Visible := true;
if true then r10.Visible := true;
if True then radiobutton.Visible := true;
end;
procedure Tf2.RadioButtonClick(Sender: TObject);
begin
if true then r1.Visible := false;
if true then r2.Visible := false;
if true then r3.Visible := false;
if true then r4.Visible := false;
if true then r5.Visible := false;
if true then r6.Visible := false;
if true then r7.Visible := false;
if true then r8.Visible := false;
if true then r9.Visible := false;
if true then r10.Visible := false;
if True then RadioButton.Visible := false
end;
procedure Tf2.s1Change(Sender: TObject);
begin
if (StrToFloat(s1.Text) >= 1) and
(StrToFloat(s1.Text) < 1.6) then Oc.Text := '1';
if (StrToFloat(s1.Text) >= 1.6) and
(StrToFloat(s1.Text) < 2.6) then Oc.Text := '2';
if (StrToFloat(s1.Text) >= 2.6) and
(StrToFloat(s1.Text) < 3.6) then Oc.Text := '3';
if (StrToFloat(s1.Text) >= 4.6) and
(StrToFloat(s1.Text) < 4.6) then Oc.Text := '4';
if (StrToFloat(s1.Text) >= 4.6) and
(StrToFloat(s1.Text) < 5.6) then Oc.Text := '5';
if (StrToFloat(s1.Text) >= 5.6) and
(StrToFloat(s1.Text) <= 6) then Oc.Text := '6';
end;
end.
(Wiem, że jest amatorski, ale niech będzie) i to co jest pogrubione i podkreślone to napisałem sam i działa, bo jak wpisze do edit1.Text '3+', to 01.Text = 3.6, tylko że dalej program nie liczy mi średniej ważonej, tylko wywala błąd:
'3.6' is not a vaild floating point value
i to będzie coś z jakąś funkcją, tylko nie wiem z którą...
Wiecie, jak to zrobić, żeby liczyło... ???
Z góry dziękuję za pomoc