Показать сообщение отдельно
  #8  
Старый 29.07.2009, 10:10
roamer roamer вне форума
Активный
 
Регистрация: 15.04.2009
Сообщения: 369
Репутация: 93
По умолчанию

А это модуль формы :
Код:
unit z1;
interface
uses
  __Str,
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Spin, Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Memo1: TMemo;
    Edit10: TEdit;
    Label1: TLabel;
    EditAnother: TEdit;
    SE_base: TSpinEdit;
    Label2: TLabel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    Splitter1: TSplitter;
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SE_baseChange(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
    ItsFirst : byte;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.Title:='10 <-> '+SE_base.Text;
  ItsFirst := 1;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
  if ItsFirst>0 then begin
     ItsFirst:=0;
     Memo1.Lines.Clear;
  end;
  Edit10.Text:=Trim(Edit10.Text);
  if (SE_base.Value>=2) and (SE_base.Value<=36) then begin
     EditAnother.Text:=Convert_Int10_to_Another(StrToInt(Edit10.Text),SE_base.Value);
     Memo1.Lines.Insert(0,'(10) '+Edit10.Text+' -> ('+SE_base.Text+') '+EditAnother.Text);
  end
  else begin
     EditAnother.Text:='Error. Основание должно быть 2..36';
  end;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if ItsFirst>0 then begin
     ItsFirst:=0;
     Memo1.Lines.Clear;
  end;
  EditAnother.Text:=Trim(EditAnother.Text);
  if (SE_base.Value>=2) and (SE_base.Value<=36) then begin
     Edit10.Text:=IntToStr(Convert_IntAnother_to_10(EditAnother.Text,SE_base.Value));
     Memo1.Lines.Insert(0,'('+SE_base.Text+') '+EditAnother.Text+' -> (10) '+Edit10.Text);
  end
  else begin
     EditAnother.Text:='Error. Основание должно быть 2..36';
  end;
end;

procedure TForm1.SE_baseChange(Sender: TObject);
begin
  Application.Title:='10 <-> '+SE_base.Text;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=32 then begin
     SpeedButton2.Click;
     Key:=0;
  end;
  if Key=13 then begin
     SpeedButton1.Click;
     Key:=0;
  end;
end;

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