いやいや、buttonのラベルが指定されてないのは、「ここにボタンを置いて使いたいが、
処理待ちのstopとbuttonで飛ぶラベルをどこに入れればよいのかわからない」ってことだろ?
buttonの使い方がわからないということはないと思うが。
で、実際に、
決定ボタンが押されるまでstopで処理待ち(無限loopを使わない)
入力ボックスとボタンは一度置いたら消さない(clrpbjを使わない)
入力された内容をすべて保持
のサンプルを作ってみました。
#uselib "user32"
#func SetWindowLong "SetWindowLongA" int, int, int
#func EnableWindow "EnableWindow" int, int
step = 0
GradeCount = 0 ;学年の数
GradeStep = 0 ;作業中の学年
dim ClassCount, 9 ;クラスの数
ClassStep = 0 ;作業中のクラス
dim StudentCount, 9, 9 ;生徒の数
mes "学年はいくつありますか?(1〜9)"
count = 0
input count
idInput = stat
SetWindowLong objinfo(idInput, 2), -16, $50012080
button "決定", *Decide
hButton = objinfo(stat, 2)
stop
*Decide
if (step ! 2) & (count <= 0 | count >= 10) : dialog "不正な値です" : stop
if step = 0 : GradeCount = count : step ++ : goto *Decide_Class
if step = 1 : ClassCount(GradeStep-1) = count : step ++ : goto *Decide_Student
if step = 2 {
StudentCount(GradeStep-1,ClassStep-1) = count
pos (GradeStep - 1) * 64, 64 + (ClassStep - 1) * 16
mes "" + GradeStep + "-" + ClassStep + ":" + count
if ClassStep = ClassCount(GradeStep-1){
if GradeStep = GradeCount : goto *AllDecided
step --
goto *Decide_Class
}
goto *Decide_Student
}
dialog "error" : end
*Decide_Class
GradeStep ++
ClassStep = 0
color 255, 255, 255 : boxf 0, 0, 320, 16
color 0, 0, 0 : pos 0, 0 : mes "第" + GradeStep + "学年には何クラスありますか?(1〜9)"
objprm idInput, 0
stop
*Decide_Student
ClassStep ++
color 255, 255, 255 : boxf 0, 0, 320, 16
color 0, 0, 0 : pos 0, 0 : mes "第" + GradeStep + "学年の第" + ClassStep + "クラスには何人いますか?"
objprm idInput, 0
stop
*AllDecided
GradeStep = 0
ClassStep = 0
StudentAmount = 0
repeat GradeCount
repeat ClassCount(GradeStep)
StudentAmount += StudentCount(GradeStep,ClassStep)
ClassStep ++
loop
ClassStep = 0
GradeStep++
loop
dialog "生徒は全部で" + StudentAmount + "人です"
EnableWindow hButton, 0
stop
やたらと長くなります。質問の順番を変えたり、無限loopで処理待ちしたりするように
すれば多少は短くなるはずですが、あえてこんな風に。