Sample menu script

The following procedure from the Real Estate Sales Manager sample application creates command-based menu. It creates a set of menus that use command lists defined in the sample dictionary, as well as built-in command lists.

local integer result;
local integer menu_tag;
local integer submenu_tag;

{Add the top-level menus}
{File menu}
menu_tag = Command_GetTag(command CL_File of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);

CommandList_Add(menu_tag, Command_GetTag(command cmdPrint));
CommandList_Add(menu_tag, Command_GetTag(command cmdPrintSetup));
CommandList_Add(menu_tag, Command_GetTag(command cmdSeparator));
CommandList_Add(menu_tag, Command_GetTag(command cmdQuitApplication));

{Edit menu}
result = MenuBar_AddMenu(Command_GetTag(command cmdListEdit));

{Tools menu}
menu_tag = Command_GetTag(command CL_Tools of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);

CommandList_Add(menu_tag, Command_GetTag(command CL_Export of form 'Main Menu'));
submenu_tag = Command_GetTag(command CL_Export of form 'Main Menu');
CommandList_Add(submenu_tag, Command_GetTag(command CMD_ExportAccess of form 'Main Menu'));
CommandList_Add(submenu_tag, Command_GetTag(command CMD_ExportExcel of form 'Main Menu'));
CommandList_Add(submenu_tag, Command_GetTag(command CMD_ExportWord of form 'Main Menu'));
CommandList_Add(submenu_tag, Command_GetTag(command CMD_ExportXML of form 'Main Menu'));

CommandList_Add(menu_tag, Command_GetTag(command cmdListMacro));
CommandList_Add(menu_tag, Command_GetTag(command cmdListResourceDescriptions));

{View menu}
menu_tag = Command_GetTag(command CL_View of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);

CommandList_Add(menu_tag, Command_GetTag(command CMD_Buyers of form 'Main Menu'));
CommandList_Add(menu_tag, Command_GetTag(command CMD_Sellers of form 'Main Menu'));
CommandList_Add(menu_tag, Command_GetTag(command CMD_Houses of form 'Main Menu'));
CommandList_Add(menu_tag, Command_GetTag(command cmdSeparator));
CommandList_Add(menu_tag, Command_GetTag(command CMD_Explorer of form 'Main Menu'));

{Reports menu}
menu_tag = Command_GetTag(command CL_Reports of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);

CommandList_Add(menu_tag, Command_GetTag(command CMD_BuyersReport of form 'Main Menu'));
CommandList_Add(menu_tag, Command_GetTag(command CMD_SellersReport of form 'Main Menu'));
CommandList_Add(menu_tag, Command_GetTag(command CMD_HousesReport of form 'Main Menu'));

{Window menu}
result = MenuBar_AddMenu(Command_GetTag(command cmdWindowList));

{Help menu}
menu_tag = Command_GetTag(command CL_Help of form 'Main Menu');
result = MenuBar_AddMenu(menu_tag);

CommandList_Add(menu_tag, Command_GetTag(command cmdLookup));
CommandList_Add(menu_tag, Command_GetTag(command cmdShowRequired));
CommandList_Add(menu_tag, Command_GetTag(command cmdSeparator));
CommandList_Add(menu_tag, Command_GetTag(command cmdHelpContents));
CommandList_Add(menu_tag, Command_GetTag(command cmdHelpSearch));
CommandList_Add(menu_tag, Command_GetTag(command cmdSeparator));
CommandList_Add(menu_tag, Command_GetTag(command cmdHelpOnWindow));
CommandList_Add(menu_tag, Command_GetTag(command cmdSeparator));
CommandList_Add(menu_tag, Command_GetTag(command cmdAboutBox));


Documentation Feedback