BUG: Menu Generated With SKIP FOR that Contains .F. Is Missing SKIP FOR (316914)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 7.0
- Microsoft Visual FoxPro for Windows 7.0 SP1
This article was previously published under Q316914 SYMPTOMS
If you use the Menu Designer to create a menu (.mpr) file that has one or more SKIP FOR expressions that contain a .F., and you generate the menu, the .mpr file does not contain the correct SKIP FOR clause, and you receive the following error message:
Function argument value, type, or count is invalid
CAUSE
A SKIP FOR expression contains a .F. before the first space in the expression.
RESOLUTION
To resolve this program, make sure that the string contains a space before the first .F.
To do this, follow these steps:
- Paste the following code in a program (.prg) file, and then run the program from the Command window to update the menu generator program:
NOTE:The menu generator is contained in a program file named Genmenu.prg, which is located in the Visual FoxPro home directory.
LOCAL lcGenMenu, lcOldText, lcNewText, lcFileText, ;
lnStartFileSize, lcSafety
* Get the file name.
lcGenMenu = HOME()+'genmenu.prg'
IF NOT FILE(lcGenMenu)
MESSAGEBOX('File '+ lcGenMenu + ' does not exist.')
RETURN
ENDIF
* Make a backup.
COPY FILE (lcGenMenu) TO (ADDBS(JUSTPATH(lcGenMenu))+ ;
JUSTSTEM(lcGenMenu)+'backup_for_q316914.prg')
* Store the original text.
lcOldText = [ IF ATC(".F.",GETWORDNUM(m.skip,1)) # 0]
* Store the replacement text.
TEXT TO lcNewText NOSHOW
lcWord1 = UPPER(GETWORDNUM(ALLTRIM(m.skip),1))
lcWord2 = UPPER(GETWORDNUM(ALLTRIM(m.skip),2))
IF lcWord1==".F." AND !EMPTY(lcWord2) AND !INLIST(lcWord2,"AND",".AND.","OR",".OR.")
ENDTEXT
* Store the genmenu contents in a string variable.
lcFileText = FILETOSTR(lcGenMenu)
* Store the original length for later comparison.
lnStartFileSize = LEN(lcFileText)
* Replace the original string with the new string.
lcFileText = STRTRAN(lcFileText,lcOldText,lcNewText)
* Write back to the file when you are finished.
IF (LEN(lcFileText)- lnStartFileSize) = ;
(LEN(lcNewText) - LEN(lcOldText))
lcSafety = SET('safety')
SET SAFETY OFF
=STRTOFILE(lcFileText, lcGenMenu,0)
SET SAFETY &lcSafety
MESSAGEBOX("Patch successfully applied!",48)
ELSE
MESSAGEBOX("Patch NOT successfully applied, ;
original file unchanged!",16)
ENDIF
RETURN
- Generate the menu again.
STATUSMicrosoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows, versions 7.0, 7.0 SP1.
Modification Type: | Major | Last Reviewed: | 4/19/2002 |
---|
Keywords: | kbbug kbBuilder kbCodeSnippet kbXBase KB316914 |
---|
|