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.

BARCOUNT(), CNTBAR(), CNTPAD()

These functions tell you how many bars are on a popup or how many pads are on a menu.

Usage

nBars = BarCount( [ cPopupName ] )
nBars = CntBar( [ cPopupName ] )
nPads = CntPad( cMenuName )

These functions expect a character string. Don’t forget the quotes around the name of the item. BARCOUNT() and CNTBAR() do the same thing—BARCOUNT() is one of the functions added in FoxPro 2.6 for dBase compatibility. When you omit the popup name, they both return information about the active popup. We had trouble getting that value to show up in the Debugger—if we put CNTBAR() in the Watch window, then activated a popup, the value wasn’t updated until we chose one of the items in the popup.

See Menus for an explanation of the different components of a menu.

Example

? BarCount("_MFILE")  && Returns 23 in VFP 6
? CntPad("_MSYSMENU") && Returns 8 with default setup

See Also

Define Bar, Define Pad, Menus