I am having problem with the menu in my application only in Development
environment. When I create EXE file and run then it works without a hitch.

I have over 130 menu items that comprise of 8 at the menu bar level and
remaining are submenus of these 8 main menu items. The application is a
multi-user application and I need to enable/disable menu items depending on
each user's access levels. The user access levels are stored in a dbf file. I
am achieving this by placing an expression in SKIPFOR field of the
mainmenu.mnx file. Here is the relevant code:

SKIPFOR field -> ifuseraccess(cUserid,prompt)

Function IfUserAccess(cUser,cPrompt)
Local nCurarea,lFound
if cUser=='SUPERMAN' && For SUPERMAN, all options are enabled.
lFound=.t.
else
nCurarea=select(0)
usefile('useraccess')
select Useraccess
set order to 1
lFound=seek(cUser+cPrompt)
select (nCurarea)
endif
Return lFound

The problem is that as long as I populate the SKIPFOR field for about 50
items or so, it works with no problem. As soon as I go upto 60 items or more
and run the application, the main menu bar displays fine but when I click on
any of the items on the menu bar, it doesn't show the dropdown menu. I have
to repeatedly click on a menu item for show its dropdown items. Once the
dropdown is displayed for one menu bar item, I can slide left or right to
other items and the dropdown menu will show but if I move the mouse away from
the menu bar and try to go back again I run into the same problem. It appears
to be a speed issue but I am not sure. The compiled EXE file works absolutely
fine.

I am using VFP 6.0 on a PIII 900 mhz. machine under XP PRO, Enterprise
edition.

I will appreciate suggestions from the experts here as this problem is
really annoying and slowing down my development process.

Thanks.

Re: Problem with Menu by Wolfgang

Wolfgang
Mon Feb 14 12:16:18 CST 2005

Hi Subhash!

I would use a public variable or a property of the Application object to
determing wether an option is en- or disabled. If you do it your way every
time the menu pops up for all bars of the menu the your function is
excecuted.
If you use a public variable or a property of the application object the
menu evaluates only the variable which is much faster.


--
----------------------------------------------

Mit freundlichen Grüßen

Wolfgang Schmale



--------------------------------------------
"Subhash" <Subhash@discussions.microsoft.com> schrieb im Newsbeitrag
news:E1DA5140-1B1B-4A1A-9751-084797764AC0@microsoft.com...
>I am having problem with the menu in my application only in Development
> environment. When I create EXE file and run then it works without a hitch.
>
> I have over 130 menu items that comprise of 8 at the menu bar level and
> remaining are submenus of these 8 main menu items. The application is a
> multi-user application and I need to enable/disable menu items depending
> on
> each user's access levels. The user access levels are stored in a dbf
> file. I
> am achieving this by placing an expression in SKIPFOR field of the
> mainmenu.mnx file. Here is the relevant code:
>
> SKIPFOR field -> ifuseraccess(cUserid,prompt)
>
> Function IfUserAccess(cUser,cPrompt)
> Local nCurarea,lFound
> if cUser=='SUPERMAN' && For SUPERMAN, all options are enabled.
> lFound=.t.
> else
> nCurarea=select(0)
> usefile('useraccess')
> select Useraccess
> set order to 1
> lFound=seek(cUser+cPrompt)
> select (nCurarea)
> endif
> Return lFound
>
> The problem is that as long as I populate the SKIPFOR field for about 50
> items or so, it works with no problem. As soon as I go upto 60 items or
> more
> and run the application, the main menu bar displays fine but when I click
> on
> any of the items on the menu bar, it doesn't show the dropdown menu. I
> have
> to repeatedly click on a menu item for show its dropdown items. Once the
> dropdown is displayed for one menu bar item, I can slide left or right to
> other items and the dropdown menu will show but if I move the mouse away
> from
> the menu bar and try to go back again I run into the same problem. It
> appears
> to be a speed issue but I am not sure. The compiled EXE file works
> absolutely
> fine.
>
> I am using VFP 6.0 on a PIII 900 mhz. machine under XP PRO, Enterprise
> edition.
>
> I will appreciate suggestions from the experts here as this problem is
> really annoying and slowing down my development process.
>
> Thanks.



Re: Problem with Menu by Subhash

Subhash
Wed Feb 16 13:45:10 CST 2005

Thank yo Wolfgang for your reply.

Before I try your solution, I tried something else and worked like a charm.
I am posting here for the benefit of someone else who might be having similar
problem. I changed the code of IfUserAccess function to as follows:

Function IfUserAccess(cUser,cPrompt)
if cUser=='SUPERMAN' && For SUPERMAN, all options are enabled.
return .t.
else
return seek(cUser+cPrompt,'useraccess')
endif

This is much simpler than the first one and cuts down 6 lines of code to
just 1 line and still achieves the same result.

Thanks again for your help.

Subhash.


"Wolfgang Schmale" wrote:

> Hi Subhash!
>
> I would use a public variable or a property of the Application object to
> determing wether an option is en- or disabled. If you do it your way every
> time the menu pops up for all bars of the menu the your function is
> excecuted.
> If you use a public variable or a property of the application object the
> menu evaluates only the variable which is much faster.
>
>
> --
> ----------------------------------------------
>
> Mit freundlichen Grü�en
>
> Wolfgang Schmale
>
>
>
> --------------------------------------------
> "Subhash" <Subhash@discussions.microsoft.com> schrieb im Newsbeitrag
> news:E1DA5140-1B1B-4A1A-9751-084797764AC0@microsoft.com...
> >I am having problem with the menu in my application only in Development
> > environment. When I create EXE file and run then it works without a hitch.
> >
> > I have over 130 menu items that comprise of 8 at the menu bar level and
> > remaining are submenus of these 8 main menu items. The application is a
> > multi-user application and I need to enable/disable menu items depending
> > on
> > each user's access levels. The user access levels are stored in a dbf
> > file. I
> > am achieving this by placing an expression in SKIPFOR field of the
> > mainmenu.mnx file. Here is the relevant code:
> >
> > SKIPFOR field -> ifuseraccess(cUserid,prompt)
> >
> > Function IfUserAccess(cUser,cPrompt)
> > Local nCurarea,lFound
> > if cUser=='SUPERMAN' && For SUPERMAN, all options are enabled.
> > lFound=.t.
> > else
> > nCurarea=select(0)
> > usefile('useraccess')
> > select Useraccess
> > set order to 1
> > lFound=seek(cUser+cPrompt)
> > select (nCurarea)
> > endif
> > Return lFound
> >
> > The problem is that as long as I populate the SKIPFOR field for about 50
> > items or so, it works with no problem. As soon as I go upto 60 items or
> > more
> > and run the application, the main menu bar displays fine but when I click
> > on
> > any of the items on the menu bar, it doesn't show the dropdown menu. I
> > have
> > to repeatedly click on a menu item for show its dropdown items. Once the
> > dropdown is displayed for one menu bar item, I can slide left or right to
> > other items and the dropdown menu will show but if I move the mouse away
> > from
> > the menu bar and try to go back again I run into the same problem. It
> > appears
> > to be a speed issue but I am not sure. The compiled EXE file works
> > absolutely
> > fine.
> >
> > I am using VFP 6.0 on a PIII 900 mhz. machine under XP PRO, Enterprise
> > edition.
> >
> > I will appreciate suggestions from the experts here as this problem is
> > really annoying and slowing down my development process.
> >
> > Thanks.
>
>
>