Keyboard input/Obtain a Y or N response: Difference between revisions

No edit summary
Line 935:
 
=={{header|M2000 Interpreter}}==
===Use a Function to return keypress and by reference return value===
<lang M2000 Interpreter>
Module Checkit {
Line 958 ⟶ 959:
</lang>
 
===Using Thread to read/write Keyboard buffer===
We use a thread, using after, for one run, after 10ms, when Input wait for keypress. So when call to GetYN module exit has Y or N with Enter to keyboard. Now Input finish.
 
Line 999 ⟶ 1,001:
</lang>
 
===Using User Form (GUI)===
<lang M2000 Interpreter>
Module UseUIForm {
Const Y=0x59, N=0x4E, Center=2
Ret=False
Declare Form1 form
Layer Form1 {
Window 22, 8000, 4000;
Cls #333333,0
Cursor 0, Height/2
Report Center, "Press (Y/N)"
}
Function form1.Keydown {
Read New &key, &shiftKey
iF key=Y then ret=True : Method Form1, "CloseNow"
If key=n Then Method Form1, "CloseNow"
}
method Form1, "Show", 1
Print Ret
Declare Form1 Nothing
}
UseUIForm
</lang>
 
=={{header|Microsoft Small Basic}}==
Anonymous user