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.
SET MARK OF
, MRKBAR()
, MRKPAD()
The SET MARK OF
command (not to be confused with SET MARK TO
) lets you put a checkmark next to a menu bar or pad. The two functions ask whether an item is marked.
SET MARK OF MENU MenuName [ TO ] cMark | lMarkIt
SET MARK OF PAD PadName OF MenuName [ TO ] cMark | lMarkIt
SET MARK OF POPUP PopupName [ TO ] cMark | lMarkIt
SET MARK OF BAR nBar OF PopupName [ TO ] cMark | lMarkIt
SET MARK OF
can be divided up two different ways. First, there are two kinds of values you can hand it: character and logical. In Visual FoxPro, the character values are ignored. (In FoxPro 2.x, they let you specify the mark character.)
The logical value determines whether the specified item has a checkmark character (like, for example, the item for the active window in Visual FoxPro’s Window menu). When lMarkIt evaluates to .T., the item is checked.
However, like other menu commands, the MENU and POPUP versions of SET MARK propagate downward. If you SET MARK OF
a popup to .T., all the bars on that popup get marked unless you issue a separate SET MARK OF
BAR command to turn off particular bars. Similarly, SETting MARK OF a MENU TO
.T. marks all the pads.
You can mark system menu items, either at the popup or the bar level. The secret is to use their built-in names. For example, to mark all the bars of the Edit menu, you'd use SET MARK OF POPUP _MEdit .T. To mark individual bars, you have to use their bar numbers. For example, use SET MARK OF BAR _med_undo .T. to mark the Edit-Undo menu bar. Of course, we have no idea why you'd ever want to mark system menu bars. |
Incidentally, although Microsoft has chosen not to document it anymore, there is a SET MARK OF
PAD command, and it does work for menu pads you define yourself.
SET MARK OF BAR 3 OF MyPopup TO .T.
lIsMarked = MRKBAR( cPopupName, nBar | SystemBarName )
lIsMarked = MRKPAD( cMenuName, cPadName)
MRKBAR()
and MRKPAD()
report whether the specified bar or pad has been marked. For system menu bars, you have to use the bar name, not in quotes. (Actually, that bar name is a number, a very negative number.)
* See GETBAR()
Define Bar, Define Menu, Define Pad, Define Popup, GetBar(), GetPad(), Menus