unit fbuttons;

interface

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

type
  TfrmButton = class(TForm)
    imgGreen: TImage;
    imgYellow: TImage;
    imgRed: TImage;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure ChangeSignal(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmButton: TfrmButton;

implementation

{$R *.DFM}

procedure TfrmButton.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmButton.ChangeSignal(Sender: TObject);
begin
  if imgGreen.Visible then
  begin
    imgGreen.Visible := False;
    imgYellow.Visible := True;
  end
  else
    if imgYellow.Visible then
    begin
      imgYellow.Visible := False;
      imgRed.Visible := True
    end
    else
      begin
        imgRed.Visible := False;
        imgGreen.Visible := True;
      end;
end;

end.
