unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    UpDown1: TUpDown;
    Label1: TLabel;
    Label2: TLabel;
    UpDown2: TUpDown;
    Label4: TLabel;
    Label3: TLabel;
    Label5: TLabel;
    procedure UpDownChangingEx(Sender: TObject; var AllowChange: Boolean;
      NewValue: Smallint; Direction: TUpDownDirection);
    procedure FormCreate(Sender: TObject);
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}



procedure TForm2.UpDownChangingEx(Sender: TObject;
  var AllowChange: Boolean; NewValue: Smallint;
  Direction: TUpDownDirection);
begin
 if Sender=UpDown2 then
 begin
   if (NewValue>=-59) and (NewValue<=59)
   then
     Label5.Caption:=IntToStr(NewValue)
   else
     AllowChange:=False
 end
 else
 begin
   if (NewValue>=-12) and (NewValue<=12)
   then
     Label3.Caption:=IntToStr(NewValue)
   else
     AllowChange:=False;
 end;

end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  Label3.Caption:=IntToStr (UpDown1.Position);
  Label5.Caption:=IntToStr (UpDown2.Position);
end;

end.
