September 29th, 2004

What does boldface on a menu mean?

On many context menus you will see an item in boldface. For example, if you right-click a text file, you will most likely see “Open” in boldface at the top of the mean. What does the boldface mean?

The boldface menu item is the default command for that menu. It represents the action that would have occurred if you had double-clicked the item instead of viewing its context menu.

In the above example, the fact that “Open” is in boldface means that if you had double-clicked the text file instead of right-clicked it, you would have opened the document.

Programmatically, the default menu item is set via the SetMenuDefaultItem function and can be retrieved with the corresponding GetMenuDefaultItem function

If you put a default menu item in a submenu, then Windows will invoke the default item in the submenu when you double-clicking the submenu’s parent. But if you put a default menu item in a top-level menu (i.e., not on a submenu), then it is your responsibility to invoke the default menu item when the user double-clicks the object that led to the menu. (This last bit should be obvious: It is the code for the object being clicked on which decides what to do on a double-click.)

We’ll see more about default menu commands next time.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.