Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

CLEAR MENUS, CLEAR POPUPS

These two commands each release different menu components from memory.

Usage

CLEAR MENUS
CLEAR POPUPS

CLEAR MENUS discards menus (the menu bar itself) and their associated pads. CLEAR POPUPS releases popups and their associated bars (that is, items—isn’t term overloading fun?).

We never use either of these because we always build our menus with the Menu Designer and base them on the system menu.

Example

DEFINE MENU mymenu
DEFINE PAD one OF mymenu PROMPT "first"
DEFINE PAD two OF mymenu PROMPT "second"
ON PAD one OF mymenu ACTIVATE POPUP three
ON PAD two OF mymenu ACTIVATE POPUP four

DEFINE POPUP three
DEFINE BAR 1 OF three PROMPT "subitem 1"
DEFINE BAR 2 OF three PROMPT "subitem 2"
DEFINE POPUP four
DEFINE BAR 1 OF four PROMPT "item 1"
DEFINE BAR 2 OF four PROMPT "item 2"
DEFINE BAR 3 OF four PROMPT "item 3"

DISPLAY MEMORY  && to see what's defined
CLEAR MENUS
DISPLAY MEMORY  && note that only menu and pads are gone
CLEAR POPUPS
DISPLAY MEMORY  && now it's all cleaned up

See Also

Release Bar, Release Menu, Release Pad, Release Popups, Set Sysmenu