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

Error generating menu

Status
Not open for further replies.

LotusE

Programmer
Nov 22, 2002
25
BE
I use Genmenu to create my menus, but I get a compile error when I want to compile my project. When I go and check the err-file, this is what is in it:

Compiling c:\prj\gcs\menus\menurec.mpr
DEFINE BAR 5 OF (a_menupops[1]) PROMPT "Save" and _screen.activeform.leditmode==.F. ) or _screen.activeform.lnorec==.T. PICTURE "..\..\..\vfp70\efc\graphics\cmdsave.bmp"
Error in line 148: Command contains unrecognized phrase/keyword.

This is what is in my "Skip for" field in the menu builder:

(_screen.activeform.laddmode==.F. and _screen.activeform.leditmode==.F. ) or _screen.activeform.lnorec==.T.


What this means is that the save-command in the menu is only available when I'm editing/adding a record or in the case that there are already records in my form. If I only leave the following:

_screen.activeform.laddmode==.F. and _screen.activeform.leditmode==.F.

I do not get any errors while compiling, but I get an error when I run the software: "Function argument, value, type or count is invalid". This is what is in the generated mpr file:

DEFINE BAR 4 OF (a_menupops[1]) PROMPT "Save" ;
and _screen.activeform.leditmode==.F. ;
PICTURE "..\..\..\vfp70\efc\graphics\cmdsave.bmp"


It will probably be something stupid, but does anyone know how to solve this?

Thanks in advance!

Cheers

LotusE
 
LotusE,

The problem might be that you're using '==' instead of '='

'==' is testing for something, '=' is assigning a value.

If you want to test _screen.activeform.laddmode use something like :
if _screen.activeform.laddmode ....
endif
or iif(_screen.activeform.laddmode,..,..)

Your "Skip for" field in the menu builder could be:

( !_screen.activeform.laddmode and !_screen.activeform.leditmode) or _screen.activeform.lnorec

Rob.

 
LotusE,

Rob is on the right track, but I think the answer is slightly different.

The problem is that the "==" operator cannot be used with anything other than character strings. Replace "==" with "=" and you should be OK.

Having said that, I can't see why you have AND after "Save" when it should be SKIP FOR. If you typed something in the SKIP box in the menu designer, then Genmenu should generate a SKIP FOR clause. Are you perhaps using a modififed version of Genmenu?

There's one other problem: Even when you get past these syntax errors, your menu will crash if you try to open it while no forms are open. That's because _SCREEN.ActiveForm won't be available. Better to write a function that tests for an open form, and then tests the relevant properties; call that function from the SKIP FOR clause.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Rob was right, replaced the code and now it works!

Thanks everyone!

Cheers

LotusE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top