Here's my code for that:
enum // dynamic menu item IDs, followed by separator IDs
{
FirstDynamicMenu = 3000,
OptionsAdjustBrightness = FirstDynamicMenu,
OptionsAdvancedFeatures,
SlopeCalculator,
BackupToCard,
RestoreFromCard,
ConnectGPS,
DisconnectGPS,
LastDynamicMenu = DisconnectGPS,
MapSeparator,
CaveSeparator,
KeypadSeparator
};
A MenuItemsStringList contains strings for the menu IDs other than a separator.
I declared several separators so as to be able to make additions in sveveral
menus of a given menu bar.
void AddMenuItem( UInt16 after, UInt16 id, Char shortcut = '\0' );
void AddMenuItem( UInt16 after, UInt16 id, Char shortcut )
{
Char string[ 32 ];
if ( id > LastDynamicMenu )
{
string[ 0 ] = MenuSeparatorChar;
string[ 1 ] = chrNull;
}
else
SysStringByIndex( MenuItemsStringList, id - FirstDynamicMenu, string,
sizeof string );
MenuAddItem( after, id, shortcut, string );
}
Luc Le Blanc
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/