Форум: "Основная";
Текущий архив: 2002.04.15;
Скачать: [xml.tar.bz2];
ВнизПомогите новичку Найти похожие ветки
← →
Zeerov (2002-04-02 16:59) [0]Добрые люди помогите.Не получается организовать двухступенчатый диалог.Одноступенчатые работают а вот двух у меня не получаются.Вот пример программы:
unit NICK;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg;
type
TForm1 = class(TForm)
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Timer1: TTimer;
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Timer2: TTimer;
Shape9: TShape;
Timer3: TTimer;
Shape10: TShape;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FlagT:Boolean=false;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
f:boolean;
begin
s:=Edit1.Text;
f:=false;
Shape7.Height:=105;
Shape8.Height:=105;
Timer1.Enabled:=True;
Timer2.Enabled:=True;
Timer3.Enabled:=True;
if s="привет!" then
begin
f:=true;
Label1.Caption:="Привет";
end
else
if (length(s)>0)and(s[length(s)]="!")then
begin
Label1.Caption:="Ну-Ну..";
f:=true;
end;
if s="как тебя зовут?" then
begin
Label1.Caption:="Гена";
f:=true;
end;
if pos("а я ",s)>0 then
begin
Label1.Caption:="А у меня 64 Мб оперативной памяти!";
f:=true;
end;
if s="где можно купить Томагочи?"then
begin
flagT:=true;
Label1.Caption:="В магазине <<Детский Мир>>";
end;
if (s="сколько она стоит?") and (flagT)
then
begin
Label1.Caption:="Двадцать пять монет";
flagT:=false;
end;
if f=false then
begin
Label1.Caption:="Ась?";
Shape9.Visible:=True;
Shape10.Visible:=True;
Timer3.Enabled:=True;
Image1.Visible:=True;
end;
Edit1.Text:="";
Edit1.SetFocus;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Shape7.Height:=57;
Shape8.Height:=57;
Timer1.Enabled:=False;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
Label1.Caption:="";
Timer2.Enabled:=False;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
Shape9.Visible:=False;
Shape10.Visible:=False;
Timer3.Enabled:=False;
Image1.Visible:=False;
end;
end.
Заранее признателен.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.04.15;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.01 c