Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Legacy Code - PageDown seems to work like ESC 1

Status
Not open for further replies.

tkee

Programmer
Feb 6, 2004
55
0
6
US
I am trying to upgrade an old program (developed in dBase IV+ and converted/updated through the years) that is currently used in FoxPro for Windows 2.5 to VFP 9.0. I have converted and renamed about a hundred reports. The new part that connects to our Oracle database and looks up information works fine. However, in testing these additions, I have found trouble with reads. Most of the screens use simple @ says and gets with variables, then reads - there are no actual compiled screens. There is a lot of information on several of the screens, and users change what they need and then PgDn to get to the place where the Read is. However, the PgDn seems to work like ESC - none of the underlying values have been changed even though they were changed on the screen. Most screens have an Edit button so the user can go back and change something if necessary. All the values go back to their original value. If I tab through each field, it works fine, but that's unreasonable on some of the financial screens. The documentation only says that READ is for backward compatibility - use forms. That isn't an option currently. Any ideas?
 
Tkee,

It's difficult to diagnose this without more information, but my guess is that the problem is nothing to do with the Reads. It's more likely to be the way in which you connect to the Oracle databaase.

In fact, it sounds like you might be using remote views to make the connection, but you haven't made the views updatable.

If that sounds plausible, let us know and I, or someone else, will give you further advice. If you're not using remote views, give us some more information about how you are communicating with Oracle.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
This is a completely different part of the program that has nothing to do with connecting to the Oracle database.
 
Just prior to the read statement, Have you tried to remap the pageDown key with the ON KEY LABEL PGDN command to something else that will not cause a problem?


David W. Grewe Dave
 
I have tried on key label pgdn with no luck. I may work on that some more. I also tried all settings of SET COMPATIBLE.
I even tried the following code - convoluted I know, but similar to my legacy and illustrates the point:

lcname = 'JOHN DOE'
lcaddr = '101 ELM STREET'
lccity = SPACE(25)
lcstate = SPACE(2)
lcwhatnext = 'E'
DO WHILE lcwhatnext = 'E'
@ 5,5 say 'Name: ' get lcname
@ 6,5 say 'Addr: ' get lcaddr
@ 7,5 say 'City:' get lccity
@ 8,5 say 'State: ' get lcstate
READ
@ 10,5 SAY '(A)bort (E)dit (P)rocess ' GET lcwhatnext PICT '!'
READ
if lcwhatnext = 'E'
LOOP
ELSE
EXIT
ENDIF
enddo

If you change any field but the last one, then immediately page down and choose edit, the information you put in the field changes back to its initial value. At least it does on my PC. It seems really simple and straightforward, and works fine in FPW.
 
How about a case statement instead of a IF after the READ to trap the PAgeDown key ???

DO CASE
CASE lastkey()= 3
LOOP
CASE lcWhatNext = "E"
LOOP
OTHERWISE
EXIT
ENDCASE

or

IF lcWhatNext = "E" OR lastkey()=3
LOOP
ELSE


David W. Grewe Dave
 
In FPW PgDn skips to the Read so that the user can continue from there without having to tab through every field. I don't need it to loop again on PgDn, but to read so that the variables are updated. Somehow in VFP PgDn is moving to that point in the code without actually reading and updating the variables.
 
I don't see why this would make a difference, but have you tried ensuring Themes are turned off?

Tamar
 
Yes, I tried turning themes off. It didn't make any difference. It apparently is the way the PgDn key works. If I tab to the next field, then PgDn, the variable has been updated, but not if I PgDn from that field. Maybe I could use On Key Label to keyboard Tab and PgDn, but that seems very awkward and may bring up other problems. Fifty plus users have been using PgDn for almost two decades on these numerous screens, so asking them to tab through dozens of fields is out of the question, and a major rewrite unfortunately isn't near the top of my priority list in the near future.
 
Tkee,

You mentioned using ON KEY LABEL to do a keyboard Tab and PgDn. I experimented with that and couldn't exactly get it to work and it seemed to get caught in a loop (even if I attempted to clear out the ON KEY LABEL for PGDN).

However, looking at the help for READ in FoxPro 2.6a, I found the note that Ctrl+W exits a READ.

So, by adding the following line to the beginning of your demo:

Code:
ON KEY LABEL PGDN KEYBOARD '{CTRL+W}'

and also inserting the following line before the EXIT line:

Code:
ON KEY LABEL PGDN

your demo should work as you described it should, i.e., you can use PageDown to get to the bottom where you can press E to edit without losing your data, or press another key to exit.

Teresa

 
You mentioned using ON KEY LABEL to do a keyboard Tab and PgDn. I experimented with that and couldn't exactly get it to work and it seemed to get caught in a loop (even if I attempted to clear out the ON KEY LABEL for PGDN).

In this case, you'd need to make sure the the PgDn in the OKL had the PLAIN keyword.

Tamar
 
Thanks so much for the help! Sometimes it's the little things that cause the most trouble. ON KEY LABEL PGDN KEYBOARD '{CTRL+W}' does exactly what I need it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top