FW: waitkey?

Mike Schwartz mschw at athenet.net
Fri Apr 8 14:08:33 PDT 2016


> I seem to remember using code that someone posted which created a timed
control of an @key function.  Of course, I can not find said code, and the
memory is not what is used to be...

> There is a great need to control (inconsiderate) users that like to use an
@key which may invoke a lookup or other process, then leave their screen,
locking the file for others.

> Does anyone recall seeing or posting this or an example?

> Thanks,

> Scott

Hi Scott:

     I'm pasting in an old email message (circa 2000) that looks like it
would do what you want.

Mike Schwartz


-----Original Message-----
From: owner-filepro-list at celestial.com
[mailto:owner-filepro-list at celestial.com] On Behalf Of Howie
Sent: Wednesday, February 23, 2000 10:35 AM
To: Carter (Butch) Ammon; filepro-list at seaslug.org
Subject: Re: waitkey? 


----- Original Message -----
From: "Carter (Butch) Ammon" <butch at rich.srcoils.com>
To: <filepro-list at seaslug.org>
Sent: Wednesday, February 23, 2000 9:45 AM
Subject: waitkey?


> Good morning,
>
> I have another idea I am considering  (Hmmmmm... can filePro do this?)
>
> **Translated into simple english**
>
> @wlf11
>
>   If: user is just sitting on field not doing anything (waitkey = "" 
> ?)
> Then: after 5 seconds goes by, Msgbox "Hey knucklehead, press enter!")
>
>
> I know this sounds crude, but it is a fresh idea that just popped into 
> my
head.
> Can filePro keep track of time?  I know there is a sleep function, but 
> I've never used it.
>
> See, field 11 is the first field on the order entry screen.  Now if 
> you sit there idle and don't hit a key, then the system holler at you to
hit a key.
>
> How do you measure time in filePro?  Can it be done?
>
> Thanks for any suggestions.
>
> "Butch" Ammon
> Super Radiator Coils
> Richmond, VA
> email: butch at rich.srcoils.com
> web: www.srcoils.com
>
>

Yes "Butch" there is a Santa Clause.
It can be done, but not easily and not with the Sleep command.  FilePro
still can only do one thing at a time, Sleeping or getting Input.  However,
with the Inkey command filepro only "strobes" the keyboard to see if any key
is depressed and does not wait for a key.

Below is a routine that will wait (on my computer) for  a keystroke for
about 7 seconds and if  no key was entered it starts flashing a wakeup
message on the screen.

         If:                         'timer to time how long
    1  Then: ix(16,.0)="1"           'the user takes to answer cc question
         If: 'The next code counts up while the user answers the company
code
    2  Then: 'question (for random number seed) so it has to handle
keystrokes
         If:                              'Note using SHOW not INPUT
    3  Then: show popup "Enter: Company Code   or   \KZ-for All  >      "
         If: '*** STARTING POSITION OF INPUT AREA ON SCREEN ***
    4  Then: ro(5,.0)="12"; co(3,.0)="64"
         If: 'cc will have the 3 char company code or blanks
    5  Then: cc(3)=""; iy(5,.0)="1"
reloop   If:
    6  Then: show "Press \KB to Browse List of Companies"
xeloop   If:
    7  Then: show (ro,co) cc;   show (ro,co) cc{""
rewait   If: 'get any key depressed
    8  Then: a=inkey
         If: 'keep counting
    9  Then: ix=ix+"1"
         If: ix ge "15000" and mod(ix,"3000")="0"
   10  Then: beep; show "\r WAKE UP DUMMY \r"
         If: ix ge "15000" and mod(ix,"4500")="0"
   11  Then: beep; show " WAKE UP DUMMY "
         If: len(a)="0"        'no key depressed
   12  Then: goto rewait
         If:                           'Some key was pressed, reset timer
   13  Then: ix="0"; show ""
         If:
   14  Then: sk=@sk
         If: a="!"
   15  Then: debug on; goto reloop
         If: sk="brky"
   16  Then: cc=""; clears; display; end
done     If: sk="entr" or sk="save" or sk="rtab"      'USER IS DONE WITH
ENTRY
   17  Then: w=""{cc{""; bl="    "; cc=mid(bl,"1","3"-len(w)) & w
         If: done
   18  Then: goto gotit
         If: sk="dmap"
   19  Then: goto dobrw
         If: sk="bs  " or sk="bksp" and iy gt "1"
   20  Then: iy=iy-"1"; mid(cc,iy,"1")=" "; goto reloop
         If: sk="clft" and iy gt "1"
   21  Then: iy=iy-"1"; goto reloop
         If: sk="crgt"
   22  Then: iy=iy+"1"; goto ckiy
         If: sk ne ""
   23  Then: goto reloop
         If: '****
   24  Then: '*** Enable next line to accept numeric entry only ***
         If: '   (a lt "0" or a gt "9") and a ne ""    'only numerics
allowed
   25  Then: '   goto reloop
         If: '****
   26  Then: '****
         If:                                         'store character in cc
   27  Then: mid(cc,iy,"1")=a; iy=iy+"1"
         If:
   28  Then: '*** Change next line to reflect the length of the field you
want
ckiy     If: iy ge "4"                               'last (third)
character?
   29  Then: goto gotit                           'end of input field
reached
         If:                                        'go back and look some
more
   30  Then: goto reloop
dobrw    If: 'do your browse lookup here
   31  Then:
         If: 'if no record was selected
   32  Then: goto reloop
gotit    If:
   33  Then: clears; show ""; display
         If: 'continue coding here
   34  Then: end


I will post the source on my website and let the group know when it is done.

Howie



More information about the Filepro-list mailing list