Inkey and Sleep
Bob Stockler
bob at trebor.iglou.com
Fri Apr 15 17:45:55 PDT 2005
Again I've lost the thread, but had a little more time to play
with the idea. The followning gives one more options when they
play with it. I execute it with:
dckerk fPfile -sAny -y '' -z inkey
It shows a little more clearly, I think, what's happening.
@MENU If: ' prc.inkey
1 Then: ' Assign Acceptable Keys to Exit the Loop:
If: ' Alpha Characters:
2 Then: declare Lets ; Lets=""
If: ' Digit Characters:
3 Then: declare Nums ; Nums="12345"
If: ' Special Keys:
4 Then: declare Skys ; Skys=""
5 Then: declare Misc ; Misc="\n Looping . . . To Break out of the Loop
\n"
6 Then: Misc=Misc & "\n Type: 1, 2, 3, 4 or 5. \n "
7 Then: declare Chars ; Chars=" ~!@#$%^&*()_+`1234567890-=
qwertyuiop{}|[]"
8 Then: Chars=Chars & "asdfghjkl;'zxcvbnm<>?,./"
9 Then: Chars=Chars & chr("92") & chr("34") & ":"
10 Then: declare Misc2 ; declare Spaces ; Spaces="
"
11 Then: declare TimeToSleep ; TimeToSleep="500"
Again If:
12 Then: sh=">" ; j=sh ; show popup Misc
Loop If:
13 Then: show("23","1") sh ; sleep TimeToSleep ; IK(1,*)=inkey
OK_Chr If: Chars co IK and IK gt ""
14 Then: KY="\r" < IK < "\r"
NOK_Chr If: NOT OK_Chr and IK gt ""
15 Then: KY="\r Special Key \r"
If: NOT OK_Chr or NOT NOK_Chr
16 Then: 'KY=Spaces
17 Then: show("7","2") "Key typed was:" < KY & Spaces
If: NOT Lets co IK and NOT Nums co IK and NOT Skys co @sk
18 Then: sh=sh { j ; goto Loop
19 Then: clearp ; show popup "\n Done Looping. Exit key was \r" < IK <
"\r \n "
20 Then: show "Press \KZ to Continue or \KY to Quit: " ; wk=waitkey ;
clearp
21 Then: show("7","2") "Key typed was:" & Spaces ; show "" ; KY="" ; goto
Again
To save anyone wanting to play with it from having to type
it in, here's a cut and paste version:
------------------------------ cut here --------------------------
@MENU::' Assign Acceptable Keys to Exit the Loop:
:' Alpha Characters:declare Lets ; Lets="":
:' Digit Characters:declare Nums ; Nums="12345":
:' Special Keys:declare Skys ; Skys="":
::declare Misc ; Misc="\n Looping . . . To Break out of the Loop \n":
::Misc=Misc & "\n Type 1, 2, 3, 4 or 5. \n ":
::declare Chars ; Chars=" ~!@#$%^&*()_+`1234567890-=qwertyuiop{}|[]":
::Chars=Chars & "asdfghjkl;'zxcvbnm<>?,./":
::Chars=Chars & chr("92") & chr("34") & "":
::declare Misc2 ; declare Spaces ; Spaces=" ":
::declare TimeToSleep ; TimeToSleep="500":
Again::sh=">" ; j=sh ; show popup Misc:
Loop::show("23","1") sh ; sleep TimeToSleep ; IK(1,*)=inkey:
OK_Chr:Chars co IK and IK gt "":KY="\r" < IK < "\r":
NOK_Chr:NOT OK_Chr and IK gt "":KY="\r Special Key \r":
:NOT OK_Chr or NOT NOK_Chr:'KY=Spaces:
::show("7","2") "Key typed was" < KY & Spaces:
:NOT Lets co IK and NOT Nums co IK and NOT Skys co @sk:sh=sh { j ; goto Loop:
::clearp ; show popup "\n Done Looping. Exit key was \r" < IK < "\r \n ":
::show "Press \KZ to Continue or \KY to Quit " ; wk=waitkey ; clearp:
::show("7","2") "Key typed was" & Spaces ; show "" ; KY="" ; goto Again:
------------------------------ cut here --------------------------
Bob (who dosen't really know why he's playing with this)
--
Bob Stockler - bob at trebor.iglou.com
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).
More information about the Filepro-list
mailing list