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.

DISPLAY MEMORY, LIST MEMORY

These commands LIST MEMORY variables.

Usage

DISPLAY | LIST MEMORY [ LIKE cFieldSkeleton ]
        [ TO PRINTER [ PROMPT ] ]
          | [ TO [ FILE ] cFileName [ ADDITIVE ]]
        [ NOCONSOLE ]

This command lists all memory variables, along with their scope, type, and value. While this can be useful for debugging, it can also be awfully wordy. We think it might be handier if we got to narrow down our list with options such as LIST MEMORY LOCAL or LIST MEMORY DATETIME.

In addition, and looking like an afterthought, at the end of the list comes a listing of other objects taking up memory: menu, pad, popup and window definitions. Although these are informative, we think they deserve their own commands, or at least keywords as above to separate them from the rest of the display.

Like most DISPLAY/LIST commands, the output can go to the screen, the active output window, or a file. For a few variables, it isn’t too bad to ACTIVATE SCREEN, LIST MEMO LIKE btn* and then press the Ctrl, Alt and Shift keys together to display the results. However, if a lot of variables need to be listed and values compared against each other, this method quickly proves tiresome. When developing in Visual FoxPro, it can be awfully hard to find the screen, an alternate output window is always too small for the long list, and you can’t scroll backward through the list. So, you could consider DISPLAYing TO FILE, and put up with the fact that the TEMP file directory has one more file in it, using the ListMemo program below.

Example

LIST MEMO LIKE LA*

* ListMemo.PRG - windowed List Memory viewer
LIST MEMORY TO FILE (SYS(2023)+ "\TEMPLIST.TXT") NOCONSOLE
MODI FILE (SYS(2023)+ "\TEMPLIST.TXT") NOWAIT

See Also

Display and List, Type()