TerMenuAddItem
Add an item to a Submenu
void TerAddMenuItem(submenu,text,CmdId)
bool TerMenuEnable2( MenuId)
MenuItem submenu; | The menu in which to add the new menu item. |
string text; | The menu item description. Set this parameter to "-" to insert a menu separator line. |
int CmdId; | A command id associated with this menu item. If this is a custom menu item, then the command id should be a number between ID_FIRST_USER_CMD and ID_LAST_USER_CMD. |
Example: Here is an example of adding the most recent file list to the File menu.
toc.TerAddMenuItem(this.Menu.MenuItems[0],"-",0);
toc.TerAddMenuItem(this.Menu.MenuItems[0],"misc.rtf",
tc.ID_FIRST_USER_CMD);
toc.TerAddMenuItem(this.Menu.MenuItems[0],"test.rtf",
tc.ID_FIRST_USER_CMD+1);When the user clicks on a file to open , you would use the Preprocess event to open the file:
protected void Preprocess(object Sender, int ActionType,
int ActionId)
{
// an example of opening a file from the most-recent file list
if (ActionType==tc.ACTION_COMMAND) {
if (ActionId==tc.ID_FIRST_USER_CMD)
toc.ReadTerFile("misc.rtf");
else if (ActionId==(tc.ID_FIRST_USER_CMD+1))
toc.ReadTerFile("test.rtf");
}
}