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.
BARPROMPT()
, PRMBAR()
, PRMPAD()
These functions look up the prompt of a particular bar or pad.
cPrompt = BARPROMPT( nBar, cPopupName )
cPrompt = PRMBAR( cPopupName, nBar )
cPrompt = PRMPAD( cMenuName, cPadName )
Like the bar and pad-counting functions, these expect character strings for the names of menu components.
Although their parameter lists are reversed, BARPROMPT() and PRMBAR() share the same weird behavior with the built-in system menu bars. Ask for PRMBAR("_MFile", 1) and you get an error message instead of "New...". To get your hands on those prompts, you have to refer to the bars using their names, not their positions. Try PRMBAR("_MFile", _MFi_New) instead. Note that you use the bar name without quotes. In fact, the bar names appear to be defined constants for a bunch of very negative numbers. ? STR(_MFi_New) yields –24064 in VFP 6 and later, and PRMBAR("_MFile", –24064) also returns "New...". |
This behavior means that to build a list of bars in a system popup, you need to first use GETBAR()
to find the actual bar numbers, then use PRMBAR()
to look up the prompts.
? PRMPAD("_MSysMenu", "_MSM_Edit") && Returns "Edit"
Define Bar, Define Pad, GetBar(), GetPad(), Menus, Sys(2013)