FPW to VFP: CLEAR READ and the READ VALID clause 
Author Message
 FPW to VFP: CLEAR READ and the READ VALID clause

Help!

Much of our legacy code, written originally in FoxPro for DOS 2.x, relies on
DOS-specific keystrokes.  Particularly, we use ctrl-W to close a window.
Our product was ported to FoxPro for Windows 2.6 about two years ago, and we
still rely heavily on this keystroke (we have SET KEYCOMP to DOS).

Now we're porting this same code to VFP5.0.  We discovered something right
from the start:  ctrl-W closes the window, as expected, unless focus is on a
command button - in which case ctrl-W presses the button.  (This is still

The solution to this was to add the following lines of code to the beginning
of EVERY command button's valid event:
    IF LASTKEY() = 23
        CLEAR READ
    ENDIF
In all, we changed about a thousand valid routines.  Yuck.  (Yes, we
automated this change, but it was no fun.)

I've just discovered something interesting:  if you issue a CLEAR READ
statement, the READ..VALID routine is not executed.  This is true for FPW as
well as VFP.

Since crtl-W behaved properly in FPW, this has never been a problem.  But
now I'm stuck:  we have 189 programs that must be examined individually,
manually, and either we move critical code out of the READ VALID routine, or
we modify the READ to be in a loop, with a SAVE clause and a CLEAR GETS.
This is really {*filter*}.

I'd love to convert all the screen code to objects and use READ EVENTS
instead, but that won't be an option for a few months yet.  (All of our code
is in PRG's instead of screen files.)

Does anyone know how to preserve the execution of a READ VALID routine, even
when CLEAR EVENTS is issued?  Is there any other way to programmatically
terminate a READ other than with CLEAR EVENTS?  (I've tried RELEASE WINDOW,
but the READ VALID doesn't fire then, either.)

I'm open to any ideas.  Thanks.

- Dan Hickok



Mon, 04 Dec 2000 03:00:00 GMT  
 FPW to VFP: CLEAR READ and the READ VALID clause

Oops.  I meant to say CLEAR READ, not CLEAR EVENTS, in the last part of that
message.
- Dan Hickok

Quote:

>Does anyone know how to preserve the execution of a READ VALID routine,
even
>when CLEAR EVENTS is issued?  Is there any other way to programmatically
>terminate a READ other than with CLEAR EVENTS?



Mon, 04 Dec 2000 03:00:00 GMT  
 FPW to VFP: CLEAR READ and the READ VALID clause

Quote:
>I've just discovered something interesting:  if you issue a CLEAR READ
>statement, the READ..VALID routine is not executed.  This is true for FPW
as
>well as VFP.

Are you sure?

I just did the following:

* runnable code starts here

read valid myudf("vvv")

proc myudf
parameters tc
  wait window tc
return

* runnable code ends here

... when I close the read using Ctrl-W, I see a wait window.  It doesn't
matter if I make the READ getful or getless.  It works the same way in VFP
and FPWin.

If I write the program this way:

* runnable code starts here
quitting = .f.
on key label f9 quitting =.t.
on key label f10 do myread

read cycle valid myudf("one") and quitting

proc myudf
parameters tc
  wait window tc timeout 2
return


read cycle valid myudf("two")
return

* runnable code ends here

... now (in both VFP and FPW), I press f10 to start my nested read.  I press
Ctrl-W.  I see "two" followed by "one".  The nested read clears, the second
does not (because of the var quitting).  I press f9 (to set quitting .T.).
I press Ctrl-W again.  I see "one", and the foundation read clears.

What am I missing here?

Quote:
>L<



Sat, 09 Dec 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Multiple Reads, Menus & Valid Clauses

2. Problem with FoxPro READ VALID clause

3. Read timeout using VALID() clause

4. Clearing READ via a Browse Valid function (FPW2.6)

5. Read Valid Clause

6. Question about READs and READ level clauses

7. Timers in VFP with Read Valid

8. READ VALID Triggered after REPORT FORM in VFP 5

9. READ level VALID in VFP?

10. FPW 2.6a VALID Clause

11. Executing Valid clause for popups in FPW 2.5

12. FPW 2.6 Screen Valid Clause

 

 
Powered by phpBB® Forum Software