- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The code that I am using to set a CHM help file to the command's ribbon button stopped working after the 2018.2 version. It works correctly in 2018 but does not work in 2019 or 2020. This is the help that is shown when the user hovers the mouse over the app command button on the add-ins ribbon and presses F1.
In the plugin class that implements IExtensionApplication, in the OnStartup method, I create the ribbon panel for the commands.
private PushButton m_commandButton; internal static string AssemblyLocation { get { return Assembly.GetExecutingAssembly().Location; } } public Result OnStartup(UIControlledApplication application) { CreateRibbonPanel(application); return Result.Succeeded; } private void CreateRibbonPanel(UIControlledApplication application) { RibbonPanel myRibbonPanel = application.CreateRibbonPanel(Strings.CommandRibbon); m_commandButton = CommandClass.AddToRibbonPanel(myRibbonPanel); } public static string GetHelpFilePath() { string helpFilePath = Path.Combine(Path.GetDirectoryName(AssemblyLocation), "CommandHelp.chm"); return helpFilePath; }
In the command class that implements IExternalCommand, I have the code to create the ribbon button.
public static PushButton AddToRibbonPanel(RibbonPanel ribbonPanel) { PushButtonData pushButtonData = new PushButtonData("CommandName", "My Command", MyPlugin.AssemblyLocation, "NameSpace.CommandClass"); pushButtonData.ToolTip = "Tool tip"; pushButtonData.LargeImage = GlobalResources.GetBitmapImageResource("Button_32x32.png"); pushButtonData.Image = GlobalResources.GetBitmapImageResource("Button_16x16.png"); pushButtonData.AvailabilityClassName = "NameSpace.CommandAvailabilityClass"; PushButton myPushButton = ribbonPanel.AddItem(pushButtonData) as PushButton; ContextualHelp contextualHelp = new ContextualHelp(ContextualHelpType.ChmFile, MyPlugin.GetHelpFilePath()); myPushButton.SetContextualHelp(contextualHelp); return myPushButton; }
This code works in 2018.2 and earlier, but stopped working in 2019.2 and later. In both versions, the GetHelpFilePath method returns the correct path to the CHM file in
"C:\\ProgramData\\Autodesk\\ApplicationPlugins\\Company Application.bundle\\Contents\\Version\\Application\\CommandHelp.chm"
In the earlier version, the help file is displayed correctly. In the later versions, the help dialog shows an error:
Solved! Go to Solution.