GetBar(), GetPad()

These functions let you figure out what's what in a popup or menu that's been rearranged in some way, either by having items released or by using a mover. GETBAR() is so confusing, we've ended up testing it every time we've ever needed to use it (but we think we've got it nailed now).

Usage

nBarNumber = GETBAR( cPopupName, nBarPosition )
cPadName = GETPAD( cMenuName, nPadPosition )
What makes GETBAR() confusing is that menu bars are numbered rather than named like all the other menu components. So GETBAR() expects a number referring to the bar's position and returns the number that identifies the bar. At first, the two numbers are the same. But, if you release any bars or if the popup has mover capability and the bars get moved around, the numbers no longer match up—at which point it starts to get confusing.GETPAD(), on the other hand, is straightforward. Hand it a menu name and a position and it tells you the name of the pad in that position. Use it together with PRMPAD() to get a list of all the prompts on a menu.Both of these functions are mostly irrelevant in VFP apps where you're unlikely to code any of this stuff by yourself.

Example

* Get the prompts of all bars picked from a mover multi-select 
* popup.
LOCAL nCnt, nThisBar
FOR nCnt = 1 TO CNTBAR()
   * first, get bar number of bar in current position
   nThisBar = GETBAR("MyPop", nCnt)
   * now, see if it's marked
   IF MRKBAR("MyPop", nThisBar)
      ? PRMBAR("MyPop", nThisBar) + " was chosen"
   ENDIF
ENDFOR
 
* Get the prompt of the third menu pad
? PRMPAD("_MSYSMENU", GETPAD("_MSYSMENU", 3))

See Also

Define Bar, Define Pad, Menus, PrmBar(), PrmPad()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .