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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back Arrow in Browse Window crashes system

Status
Not open for further replies.

amatureo

Programmer
Aug 5, 2008
38
US
For years I have been annoyed by what appears to be a random crash in browse windows. The back arrow will work most of the time to move the cursor back a column, but at other times it will crash the system. I don't know how to figure this out.
I'm using DOS Foxpro 2.5 on Win98SE and WinXP computers.

Any suggestions on how to troubleshoot this problem.
 
I'd be suspicious of the FoxUser.DBF resource file. When the problem occurs, try renaming FoxUser.DBF so that FoxPro creates a new one and see if the problem goes away.

Tamar
 
You may also have a corrupted data or index file. I would suggest you first create a backup of each, then pack, reindex, or even create new files and append from the old ones.
See if that makes a difference.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I doubt that it is a FP problem.

I have the same problem on various websites on the internet. Random crashes only when using the BS. And only on computers using some sort of junk MS operating systems.

So, I suspect it is a problem in the PC operating system itself and not in any specific programming language.

mmerlinn


"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Steven Raymond
 
There could be a key mapping command in the code somewhere which was not cleaned up properly, and only emerges in certain conditions.

ON KEY LABEL BACKSPACE DO myprogram
 
I shouldn't have said back arrow. I'm not talking about the backspace key, I'm talking about the left arrow. I can't move left one column in a browse window without risking a crash. It works more often than it crashes, but every crash is a problem.

I've even tried key mapping to disable the left arrow. My thinking was that it would force the use of the enter key - moving right, looping back around to the desired column in the browse field. I was unsuccessful in creating an ON KEY LABE LEFTARROW workaround.

Thanks for any other ideas.

 
OK, here's the latest.

My workaround to prevent crashes when using the LEFT ARROW in a browse window is:

ON KEY LABEL LEFTARROW REPL(CHR(13),x)

x is the number of fields in the browse window minus 1. This moves the cursor right until it ends up at the previous field.

This is clumsy, but it does prevent those unexplainable random program crashes. Because I start numerous browses with a memory variable I call BR_FIELD, I realize that x will always be the number of commas in BR_FIELD.

Example:

BR_FIELD=" BROW FIEL CODE:V=CODE#' ',NAME,TYPE "

There are 3 fields accessed in the browse. There are 2 commas in BR_FIELD. I need to use:

ON KEY LABEL LEFTARROW REPL(CHR(13),2)

I just need to create a function that counts the number of commas in BR_FIELD. I will write one if necessary, but are there existing functions in FPD which can count the number of occurrences of a character in a string?
 
I went ahead and created my own function. It requires a little more programming whenever I want to browse, but it does remedy the crashing.

FUNC OIS
* ------- O)ccurrences I)n S)tring --- Returns number
* OIS_C - Character looked for
* OIS_S - String to look in
PARA OIS_C,OIS_S
FOR i=1 TO 100 && Upper limit arbitrarily set at 100
IF AT(OIS_C,OIS_S,i)=0
RETU i-1
ENDI
ENDF
RETU
* (EOF NOIS)
* ---------
 
[ ]
How about something like:

NumChar = LEN(OIS_S) - LEN(STRTRAN(OIS_S, OIS_C))

Not tested.




mmerlinn


"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Steven Raymond
 
I guess I'm stuck with the extra code required before each browse window is opened in my programs.

ON KEY LABEL LEFTARROW KEYB REPL(CHR(13),x)

x is the number of fields in the browse window minus 1. This moves the cursor right until it wraps around and stops at the previous field.

This is NOT a perfect solution. I have some browse windows that access a variable number of the fields depending on information in other fields. The left arrow in those cases doesn't always position the cursor correctly. I also have to remember to ON KEY LABEL LEFTARROW after each browse or users have problems when they try to left arrow in other parts of the program.

I would prefer for the LEFTARROW to execute correctly without special workarounds, but I've been unsuccessful in error trapping the random LEFTARROW system crash. There must be a way, but ALAS, I may have to give up the pursuit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top