Can't get filemenubar to delete a custom menu

I create a custom menu thus:

filemenubar "all",
    menu("Goodies") +

and then try to remove it with:

filemenubar "","","-Goodies"

as described in the filemenubar documentation. Nothing happens.

Each time you run filemenubar you are building menus from scratch. It’s not building on what was done before, in other words, it’s not cumulative. So all you need to do is:

filemenubar "all",""

The minus option is only for excluding standard menus, for example this would exclude the Action menu.

filemanubar "all -action"

Your code has another problem – you’ve specified an invalid menu bar in the third parameter. This parameter is for specifying what menu bar is being modified. Usually this parameter is omitted and the DATA_MENUBAR is implied, which is the main menu bar. You can also specify DATA_CONTEXTMENU or COLUMN_CONTEXTMENU to customize those context (right click) menus. You’ve specified -Goodies, which is not a legal menu bar, so I think your code is actually doing nothing at all (which is actually a good thing, because I think otherwise this code would have completely removed all of the menus, since you didn’t specify any).

When I run the following:

FileMenuBar "all", ""

It generates this (see screenshot).

What do I have to do to fix this?


Well – one clue: if I change the command to be:

FileMenuBar "all -action", ""

Then the extra menus do not appear.
Reading the help on “Action menus” seems to hint that the two might not be compatible.

Can anyone confirm that?


I tried, but I couldn’t reproduce the menu in your screen shot. None of the menus appear twice.

1 Like

I can’t duplicate this either. But I suppose I could, by setting up multiple Action menus on purpose with those names. Are there procedures in your View menu with names like (File), (Edit), etc.?

FYI, there is absolutely no problem combining Action menus with custom menus. Panorama X has only one menu system, and Action menus are simply a part of that.

(Thanks for looking into this …)

Very strange. This is a database brought over from Pano 6.

Is there maybe a “special variable” that gets set in the process?

I tried creating a variety of menus using “FileMenubar” and at one point got it into a state where the “prodedure-related” menus were the only ones being displayed — even when switching to other form windows. Once in this state, I needed to quit Panorama and relaunch it to “fix” the menus.


I think I’ve “solved” this one.
I like to build things in variables … so, I built the menu in a local variable, and then used that in the “FileMenubar” command.

Something like this:

Let myMenu = Menu("MyMenu")+MenuItem("MyMenuItem 1")
FileMenubar "all", myMenu

It would show for a bit, but once you switch to other windows, it would never re-appear.

Once the following is done, then it works as expected:

LetFileGlobal myMenu = Menu("MyMenu")+MenuItem("MyMenuItem 1")
FileMenubar "all", myMenu

Then it works as expected.

Maybe a hint somewhere in the docs that either “FileGlobal” or “Global” variables are required here. (For those of us who learn something, and then promptly forget it again … :wink: – yeah, I’m posting this for myself, for posterity! :rofl: )

That is not the way to do custom menus. It’s working for you because all of your menus are apparently static and never change. So what’s happening is your variable is set up containing the static menu definitions. But the way this is intended to work is as the examples show, with the formula as part of the filemenubar statement. What this statement does is stash the formula away. Then whenever the menu bar is clicked, it evaluates the formula at that time. So if you are doing things like having checked menu items, menu items based on an array, etc., all of that will be evaluated when the menu bar is clicked, so that it can change as necessary.

In your code this is all getting evaluated during the let statement. So any dynamic elements won’t work. So I would get rid of the variable, and put the formulas right into the statement, as shown in the examples in the documentation.

Ahhhhhhh … ok. Thanks! :wink: :rofl: