0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
| //等差連番挿入
var
intCnt,intDef,intCount:integer;
strBuff,strDist,strLeft,strRight:string;
begin
strBuff := InputBox('初期値入力','連番の初期値を入力してください。',''); // 初期値 入力
if( strBuff = '') then exit; // キャンセルまたは入力がない場合は終了
intCnt := StrToInt(strBuff); // 挿入数値の初期値
strBuff := InputBox('差分入力','連番の差分を入力してください。',''); // 差分 入力
if( strBuff = '') then exit;
intDef := StrToInt(strBuff); // 更新する際の差分
repeat
strBuff := InputBox('繰り返し回数入力','繰り返す回数を入力してください。',''); // 繰り返し回数 入力
if( strBuff = '') then exit;
intCount := StrToInt(strBuff); // 挿入回数
if( intCount <= 0 ) then // 繰り返し回数 確認
begin
intCount := MessageBox('繰り返し回数は1以上の整数を指定してください。',
'繰り返し回数 入力 エラー',$15); // エラーメッセージ 表示 flg:エラーアイコン + [再試行]&[キャンセルボタン]
if ( intCount = 2 ) then
exit // キャンセルの場合 終了
else
intCount := -1; // 再試行の場合 繰り返す為に-1をとりあえず設定
end;
until (intCount > 0); // 繰り返し回数が1以上 終了
strLeft := InputBox('左側挿入文字入力','数値の左側に挿入する文字列を入力してください。',''); // 左挿入文字列 入力
// if( strLeft = '') then exit; // 何も挿入しない場合に対応できない為、コメントアウト
strRight := InputBox('右側挿入文字入力','数値の右側に挿入する文字列を入力してください。',''); // 右挿入文字列 入力
// if( strRight = '') then exit;
strDist := InputBox('移動する方向を数字で入力してください','↑: 8, ↓: 2, →: 6, ←: 4',''); // 移動する方向 入力
if( strDist = '') then exit;
while ( intCount > 0 ) do
begin
S_MoveHistSet; // 現在位置 記録
S_InsText ( strLeft + IntToStr(intCnt) + strRight ); // 数値 挿入
if ( strDist = '8' ) then // 上に移動する場合
begin
S_MoveHistPrev; // 挿入する前の位置へ戻って
S_Up; // 上へ移動
end
else if ( strDist = '2' ) then // 下に移動する場合
begin
S_MoveHistPrev; // 挿入する前の位置へ戻って
S_Down; // 下へ移動
end
else if ( strDist = '4' ) then // 左に移動する場合
S_MoveHistPrev // 挿入する前の位置へ戻る
else // 右に移動する場合
; // 何もしない
intCnt := intCnt + intDef; // 挿入数値 更新
intCount := intCount - 1; // 挿入回数 更新
end;
end;
|