Microsoft KB Archive/316914

= BUG: Menu Generated With SKIP FOR that Contains .F. Is Missing SKIP FOR =

Article ID: 316914

Article Last Modified on 4/19/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Service Pack 1

-



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 lcGenMenu = HOME+'genmenu.prg' IF NOT FILE(lcGenMenu) MESSAGEBOX('File '+ lcGenMenu + ' does not exist.') RETURN ENDIF COPY FILE (lcGenMenu) TO (ADDBS(JUSTPATH(lcGenMenu))+ ;   JUSTSTEM(lcGenMenu)+'backup_for_q316914.prg')
 * Get the file name.
 * Make a backup.

lcOldText = [  IF ATC(&quot;.F.&quot;,GETWORDNUM(m.skip,1)) # 0]
 * Store the original text.

TEXT TO lcNewText NOSHOW lcWord1 = UPPER(GETWORDNUM(ALLTRIM(m.skip),1)) lcWord2 = UPPER(GETWORDNUM(ALLTRIM(m.skip),2)) IF lcWord1==&quot;.F.&quot; AND !EMPTY(lcWord2) AND !INLIST(lcWord2,&quot;AND&quot;,&quot;.AND.&quot;,&quot;OR&quot;,&quot;.OR.&quot;) ENDTEXT
 * Store the replacement text.

lcFileText = FILETOSTR(lcGenMenu) lnStartFileSize = LEN(lcFileText) lcFileText = STRTRAN(lcFileText,lcOldText,lcNewText) IF (LEN(lcFileText)- lnStartFileSize) = ; (LEN(lcNewText) - LEN(lcOldText)) lcSafety = SET('safety') SET SAFETY OFF =STRTOFILE(lcFileText, lcGenMenu,0) SET SAFETY &lcSafety MESSAGEBOX(&quot;Patch successfully applied!&quot;,48) ELSE MESSAGEBOX(&quot;Patch NOT successfully applied, ; original file unchanged!&quot;,16) ENDIF RETURN  Generate the menu again.
 * Store the genmenu contents in a string variable.
 * Store the original length for later comparison.
 * Replace the original string with the new string.
 * Write back to the file when you are finished.



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows, versions 7.0, 7.0 SP1.



Steps to Reproduce the Behavior
  To create a new menu, run the following code from the Command window: CREATE MENU MENUTEST  In the New Menu dialog box, click Menu.</li> Under Prompt, type Test, and then click Command in the Result list.</li> Type ?&quot;test&quot; in the Command text box.</li>  Click Options, and then paste the following text in the Skip For text box: lnTest1=.F. and lnTest2=.T.                   </li> Click OK.</li> On the Menu menu, click Generate.</li>  To open the .mpr file, run the following code from the Command window: MODIFY COMMAND MENUTEST.MPR </li>  Examine the DEFINE PAD command in the .mpr file, and observe that it contains the following: DEFINE PAD _0l10tlzkl OF _MSYSMENU PROMPT &quot;test&quot; COLOR SCHEME 3 ; KEY ALT+T, &quot;&quot; ; and lnTest2=.T.                   </li> Run the .mpr file, and note that you receive the error message that is described in the &quot;Symptoms&quot; section. Also note that the SKIP FOR clause is omitted, and all of the characters before and including the first .F. are omitted.</li></ol>

Keywords: kbbug kbfix kbxbase kbcodesnippet kbbuilder KB316914

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.