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

How to tell if a Menu or a PopupPad is Shown

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

How can I tell (programatically) if a menu or a popup pad has been built or shown?
What do I test for?

if menu popup pad exists
llMenuExists = .T.
else
llMenuExists = .F.
endif

The error is "Menu has not been defined with Define PopUp"

Thanks, Stanley
 
CntBar() might get what you want. See the help file entry.

But your question is quite vague.

The error message "Menu has not been defined with Define PopUp" is excruciatingly accurate. It means exactly what it says.

This almost sounds like a code organizational problem. Your code improperly encounters ACTIVATE before DEFINE, or perhaps in a loop something issues RELEASE before the second time through?

 
It is accurate, its that on app loadup I check some env things before I create/load the menus.

It occurs before the login page at which time there is no menu as it loads different menus based on the user's level. If something is not as expected in the env, (this occurs before the login), I then redirect the user to a "settings" form. Note that this form is loaded in this special case before the login form and before any menus.

This settings form contains licensning data and place to add 3rd party apps, which will build the menu the pads for them. At this point I need to check if the menu or pads exists and branch around it as there is code that builds/updates the menu popups when the user applies the settings.

I know of other ways around this problem such as "do form settings with 'NoMenus'", but was wondering if there was a way to test if menu/popup pad was up or created...

I'll check on the function you mentioned...

Thanks, Stanley

 
Please accept this with respect. You're going about this in the wrong way, and the errors you're seeing are rubbing your nose in it.

Menus have always been Foxpro's dirty little secret. They work a specific way. They work quite well, exactly the way they work. But stray from the path they expect and they'll make you regret it.

The fact that you're having trouble tells me you're probably writing code by hand, which you shouldn't be doing. Use the menu builder, and also genmenux ( and let the tool do what it does best.
 
Stanley,

Based on what you said about the login and settings forms, I think your best bet would be to do a minor re-design, so that the menus are created only after a successful login (and only after you know the user's level). I feel sure that would be simpler than your present approach.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Mike,

I done it the way I mentioned at the top of this post. I was hoping there was a simple way to use an existance test...

At the top of my main.prg, i created a variable and when calling the form I pass its value to a form variable. If I get to this form from an area where the menus are up, I just change its value. I also had to add code in all the locations that could call this form and set the variable's value accordingly.

If thisform.FromForm <> 'NotLoggedInNoMenu'
Do 'MyAppsMenuPads'
Do 'RdcSitesMenuPads'
Endif

Anyway it works...

Thanks, Stanley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top