Some changes I made in StdFunc.TPW
In 8 places CheckOpen() passes NAME(File)
as in StandardWarning(Warn:xxx, NAME(File))
so you know what file caused the error.
Problem is sometimes the File Name Name(var) is blank (a bug) so the Warning Message file name is blank, which makes it almost impossible to find the problem. In CheckOpen() I changed so if the Name(File) is blank then I show “Alternative Text”. I created a variable NameOfFile and use that in place of Name(File) in those 8 places.
There is no way I know of to get the Label of the File so my “Alternative Text” is File{Prop:Label,1}
i.e. the Label of the 1st Field. That way you at least get a Prefix so should have an idea of the file.
Here’s the CheckOpen first few lines of code.
CheckOpen PROCEDURE(FILE File,<BYTE OverrideCreate>,<BYTE OverrideOpenMode>)
OpenMode BYTE
NameOfFile PSTRING(256),AUTO !Name(File) or Prop:Label #! Carl added
CODE
#! Carl Show 1st field Label if Name is blank (until SV fixes F{Prop:Label})
NameOfFile=CLIP(CHOOSE(~NAME(File),'Name=Blank [' & File{Prop:Label,1} &']',NAME(File)))
#EMBED(%CheckOpenSetup,'CheckOpen: Setup Procedure')
The CHOOSE(~Name...)
checks if there’s a blank NAME()
then uses File{Prop:Label,1}
formatted as: Name=Blank [Pre:LabelField1]
e.g. Name=Blank [Cus:AutoNo]
Next change the 8 calls that pass NAME(File)
to variable NameOfFile
- e.g.:
Old: IF StandardWarning(Warn:CreateError,NAME(File)). !Name() could be blank
New: IF StandardWarning(Warn:CreateError,NameOfFile). !Carl New code
There is a bug in OF Warn:BadKeyedRec that there is a missing comma. The Icon ends up in the Caption and the Button in the Icon. Plus the language refers to “Insert Aborted” when it’s a “'Read Failed”. Here’s the old and my fixed code:
OF Warn:BadKeyedRec
RETURN(MESSAGE('Unable to read keyed record. Error: ' |
Old: & CLIP(ErrorText) & '. Insert Aborted',ICON:Exclamation,|
Fix: & CLIP(ErrorText) , 'Read Failed' ,ICON:Exclamation,|
All the message code ends with “,0)” which can be changed to “,MSGMODE:CANCOPY)” so the user can copy the message text:
Old: Button:OK,Button:OK,0))
New: Button:OK,Button:OK,MSGMODE:CANCOPY))