Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I want an error for VFP Open dialog
Message
 
 
To
12/03/2004 13:05:38
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00885697
Message ID:
00904546
Views:
13
Hi Fabio,

I've read through most of this thread with a lot of interest. As a programmer I understand the NABAF phrase ("It's Not a Bug, it's a Feature") and I will admit that I have used this on occasion myself. However I feel that in this case to say that is a cop out and I have added my comment to the VFP9 wish list to allow this "feature" to be turned off.

There certainly has been a lot of opinions about this in this thread, but I haven't seen any solutions or work arounds suggested to you so I would like to make one.

I've been working on a legacy system that is well established with many users across the country. Once in awhile a user encounters a bogus open dialog box and calls our support department. Even when they cancel that dialog box an error is not always generated. Whether this IS a bug of VFP or not I'm not sure. Since this occurrence is not consistent we have had a hard time tracking this problem down so this is what I did.

I created a DBC with one table in it, called something like "LOGERROR.DBF".
When the user gets the bogus dialog box they are instructed to select this table as the one to open.

In the BeforeOpenTable event I have the following code.

PROCEDURE dbc_BeforeOpenTable(cTableName)
** Before a table or view is opened.
PUBLIC nLevels, aProgChain
EXTERNAL ARRAY aProgChain
DECLARE aProgChain[1,1]
nLevels = ASTACKINFO(aProgChain)
ENDPROC

In the AfterOpenTable event I did something like this.

PROCEDURE dbc_AfterOpenTable(cTableName)
** After a table or view is opened.
IF nlevels > 0 AND TYPE("APROGCHAIN")<>"U"
lcTrace = "Bogus Open Dialog Box"+CHR(13)+"Call Stack Trace:"+CHR(13)+REPLICATE("-",60)+CHR(13)
FOR lnx = nLevels TO 1 STEP -1
IF UPPER(RIGHT(ALLTRIM(aProgChain(lnx,2)),8))<>"LOGERROR.DCT"
** Save Values to Log File
lcTrace = lcTrace + "Stack Level:"+ALLTRIM(STR(aProgChain(lnx,1)))+CHR(13) ;
+"File Name:"+ALLTRIM(aProgChain(lnx,2))+CHR(13) ;
+"Module or Object Name:"+ALLTRIM(aProgChain(lnx,3))+CHR(13) ;
+"Source Code File Name:"+ALLTRIM(aProgChain(lnx,4))+CHR(13) ;
+"Line Number:"+ALLTRIM(STR(aProgChain(lnx,5)))+CHR(13) ;
+"Line of Code:"+ALLTRIM(aProgChain(lnx,6))+CHR(13) ;
+REPLICATE("-",60)+CHR(13)
ENDIF
NEXT lnx
** Then here I save to an error log text file and display a messagebox to user that 'Bogus Dialog Error' has been logged.
ENDIF
IF USED("LOGERROR")
SELECT LOGERROR
USE
ENDIF
ENDPROC

Then they can email us the text file and we can see the EXACT line of code that generated the dialog box and fix the code.

Don't know if this is a help to you but thought I would post it as an idea to help track down these types of problems.

Regards!
Kevin Scott
kehvn@carolina.rr.com


Hey! It's not my fault. It's some General named Protection!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform