Показать сообщение отдельно
  #29  
Старый 21.01.2012, 22:51
Kaktuz Kaktuz вне форума
Начинающий
 
Регистрация: 30.10.2011
Сообщения: 149
Репутация: 10
По умолчанию

Правильно оформил?
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ActnList;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    ActionList1: TActionList;
    Up: TAction;
    Down: TAction;
    procedure UpExecute(Sender: TObject);
    procedure DownExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  TPlayerDirection = (pdLeft, pdRight, pdUp, pdDown);

var
  Form1: TForm1;
  LRUD: TPlayerDirection;

implementation

{$R *.dfm}

procedure TForm1.UpExecute(Sender: TObject);
begin
if LRUD = pdUp then
  Label1.Caption := 'Up >>>'
else
  begin
  Label1.Caption := 'Up';
  LRUD := pdUp;
  end;
end;

procedure TForm1.DownExecute(Sender: TObject);
begin
if LRUD = pdDown then
  Label1.Caption := 'Down >>>'
else
  begin
  Label1.Caption := 'Down';
  LRUD := pdDown;
  end;
end;

end.
Ответить с цитированием