The CMenu SetDefaultItem function is used to set the default item in a menu. This function takes two arguments: the item command ID and a Boolean flag that indicates whether the item should be redrawn.
Example:
CMenu myMenu; myMenu.LoadMenu(IDR_MAINFRAME); // Load the menu resource myMenu.SetDefaultItem(ID_FILE_NEW, TRUE); // Set New File as the default item
This example loads the main menu resource and sets the "New File" item as the default item. When the user opens the menu, the "New File" item will be highlighted automatically.
Package library: MFC (Microsoft Foundation Classes)
C++ (Cpp) CMenu::SetDefaultItem - 18 examples found. These are the top rated real world C++ (Cpp) examples of CMenu::SetDefaultItem extracted from open source projects. You can rate examples to help us improve the quality of examples.