rendered paste bodyunit langas1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Button1: TButton;
Ivedimas: TEdit;
Button2: TButton;
Memo1: TMemo;
Klausimas: TMemo;
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure klausk;
public
{ Public declarations }
end;
var
Form1: TForm1;
i: integer;
atsakymas: string;
implementation
{$R *.dfm}
procedure TForm1.Klausk;
var s, s2: string;
begin
Ivedimas.Text := '';
Memo1.Lines.LoadFromFile('klausimai.txt');
i := //Random(Memo1.Lines.Count) ;
i := i+1;
s := Memo1.Lines[i];
if Pos('#',s) > 0 then begin
s2 := s;
Delete(s2,1,Pos('#',s));
Image1.Picture.LoadFromFile(ExtractFilePath(Application.Exename)+'images\'+s2);
s := Copy(s,1,Pos('#',s)-1);
Image1.Visible := True;
end else Image1.Visible := False;
s2 := s;
Delete(s2,1,Pos('*',s));
Atsakymas := s2;
Delete(s,Pos('*',s),Length(Atsakymas)+1);
Klausimas.Text := s;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if lowercase(Ivedimas.Text) = lowercase(Atsakymas) then begin
Application.MessageBox('Teisingai!','Istorija',MB_OK + MB_ICONINFORMATION);
Klausk;
end else begin
Application.MessageBox('Neteisingai!','Istorija',MB_OK + MB_ICONERROR);
Ivedimas.Text := '';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.MessageBox(PChar('Atsakymas buvo: '+Atsakymas),'Istorija',MB_OK + MB_ICONINFORMATION);
Klausk;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Image1.Visible := False;
Randomize;
klausk;
end;
end.