type
TValSet = record
xsize : integer ;
ysize : integer ;
angle : integer ;
end;
TForm1 = class(TForm)
TabControl1: TTabControl;
・・・
procedure FormShow(Sender: TObject);
private
{ Private 宣言 }
vals : array[0..4] of TValset ;
public
{ Public 宣言 }
end;
・・・
// 文字列→整数
function SInt(s:string):integer ;
var
i,j : integer ;
begin
i := 0 ;
if (s <> '') then begin
Val(s,i,j);
if (j <> 0) then i := 0;
end;
Result := i;
end;
// 起動時
procedure TForm1.FormShow(Sender: TObject);
var
i : integer ;
begin
for i:=0 to 4 do begin
with vals[i] do begin
xsize := 0 ;
ysize := 0 ;
angle := 0 ;
end;
end;
end;
// タブ切替直前処理=各値を保存
procedure TForm1.TabControl1Changing(Sender: TObject; var AllowChange: Boolean);
var
i : integer ;
begin
i := TabControl1.TabIndex ;
if (i >= 0) then begin
with vals[i] do begin
xsize := SInt(Edit1.Text) ;
ysize := SInt(Edit2.Text) ;
angle := SInt(Edit3.Text) ;
end;
end;
end;
// タブ切替直後処理=各値を表示
procedure TForm1.TabControl1Change(Sender: TObject);
var
i : integer ;
begin
i := TabControl1.TabIndex ;
if (i >= 0) then begin
with vals[i] do begin
Edit1.Text := IntToStr(xsize) ;
Edit2.Text := IntToStr(ysize) ;
Edit3.Text := IntToStr(angle) ;
end;
end;
end;