to tez nie pomaga, ale thx
Co ru moze byc zle ?!?
Zamieszczam caly kod tym razem moze w nim cos jest nie tak
unit kod_formy_glownej;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, StdCtrls, ComCtrls;
type
TfGlowna = class(TForm)
menu: TMainMenu;
Opcje1: TMenuItem;
est1: TMenuItem;
N1: TMenuItem;
Exit1: TMenuItem;
Panel1: TPanel;
bTest: TButton;
bEditWords: TButton;
bExit: TButton;
lNapisTytulowy0: TLabel;
lNapisTytulowy1: TLabel;
Panel2: TPanel;
ePolishWord: TEdit;
eEnglishWord: TEdit;
bNext: TButton;
Label1: TLabel;
Label2: TLabel;
GroupBoxScore: TGroupBox;
lGoodAnswers: TLabel;
lBadAnswer: TLabel;
lScoreGood: TLabel;
lScoreBad: TLabel;
Exit2: TMenuItem;
Options1: TMenuItem;
bEndTest: TButton;
bCheck: TButton;
procedure bExitClick(Sender: TObject);
procedure bEditWordsClick(Sender: TObject);
procedure bTestClick(Sender: TObject);
procedure Exit2Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bCheckClick(Sender: TObject);
procedure bNextClick(Sender: TObject);
procedure bEndTestClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fGlowna: TfGlowna;
liczbaDobrych: Integer;
liczbaZlych: Integer;
slowo0: String;
slowo1: String;
slowo2: String;
slowo3: String;
slowo4: String;
slowo5: String;
slowo6: String;
implementation
{$R *.dfm}
uses
kod_formy_Edit_words,kod_formy_options, Math, IniFiles, StrUtils;
procedure TfGlowna.bExitClick(Sender: TObject);
begin
Close;
end;
procedure TfGlowna.bEditWordsClick(Sender: TObject);
begin
fEditWords.ShowModal;
end;
procedure TfGlowna.bTestClick(Sender: TObject);
var
iniFile: TIniFile;
begin
iniFile := TIniFile.Create(ExtractFilePath(Application.ExeName)+ 'words.ini');
bEditWords.Enabled := False;
ePolishWord.Text := iniFile.ReadString('Polish_Words', 'word0', 'error');
bEndTest.Enabled := True;
end;
procedure TfGlowna.Exit2Click(Sender: TObject);
begin
close;
end;
procedure TfGlowna.N1Click(Sender: TObject);
begin
fEditWords.ShowModal;
end;
procedure TfGlowna.FormCreate(Sender: TObject);
begin
bEndTest.Enabled := False
end;
procedure TfGlowna.bCheckClick(Sender: TObject);
var
iniFile: TIniFile;
begin
iniFile := TIniFile.Create(ExtractFilePath(Application.ExeName)+ 'words.ini');
slowo0 := iniFile.ReadString('English_Words', 'word0', 'error');
slowo1 := iniFile.ReadString('English_Words', 'word1', 'error');
slowo2 := iniFile.ReadString('English_Words', 'word2', 'error');
slowo3 := iniFile.ReadString('English_Words', 'word3', 'error');
slowo4 := iniFile.ReadString('English_Words', 'word4', 'error');
slowo5 := iniFile.ReadString('English_Words', 'word5', 'error');
slowo6 := iniFile.ReadString('English_Words', 'word6', 'error');
if eEnglishWord.Text = '' then
begin
ShowMessage('You must write the answer!');
end;
if eEnglishWord.Text = slowo0 then
begin
liczbaDobrych := liczbaDobrych + 1;
lScoreGood.Caption := IntToStr(liczbaDobrych);
end
else
liczbaZlych := liczbaZlych + 1;
lScoreBad.Caption := IntToStr(liczbaZlych);
end;
procedure TfGlowna.bNextClick(Sender: TObject);
var
iniFile: TIniFile;
slowo: array[0..6] of string;
i: Integer;
begin
iniFile := TIniFile.Create(ExtractFilePath(Application.ExeName)+ 'words.ini');
slowo[0] := iniFile.ReadString('Polish_Words', 'word0', 'error'); //tu nie bylo nawiasow
slowo[1] := iniFile.ReadString('Polish_Words', 'word1', 'eSDror');
slowo[2] := iniFile.ReadString('Polish_Words', 'word2', 'eAAArror');
slowo[3] := iniFile.ReadString('Polish_Words', 'word3', 'error');
slowo[4] := iniFile.ReadString('Polish_Words', 'word4', 'error');
slowo[5] := iniFile.ReadString('Polish_Words', 'word5', 'error');
slowo[6] := iniFile.ReadString('Polish_Words', 'word6', 'error');
// otwarcie INI
for i := 0 to 6 do
slowo[i] := iniFile.ReadString('Polish_Words', 'word' +IntToStr(i), 'error');
// zamknięcie INI
for i := 0 to 5 do
if ePolishWord.Text = slowo[i] then ePolishWord.Text := slowo[i +1]
end;
procedure TfGlowna.bEndTestClick(Sender: TObject);
begin
bEditWords.Enabled := True;
end;
end.