Reply
Solved! Go to solution

Add help from chm to add-in buttons

Hi all,

 

Does anyone try and manage to associate a chm file or a topic of a chm file using F1 key on an addin button ?

 

Romuald.


Romuald BERTIN
4 REPLIES

Re: Add help from chm to add-in buttons

There is information in the SDK about this topic. Specifically, open .\SDK\Advanced\samples\Addins\VC\AsmLoc.sln. Then open commands.cpp and search for CCommands::XAddInEvents::raw_OnCommandHelp and read through the notes.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Add help from chm to add-in buttons

Hi Jason,

 

Thanks for this answer, I'm not familiar with C++ and my code is in VB.net.

 

I don't know why it wont work.

Here is a part of my code :

    Inherits SolidEdgeCommunity.AddIn.SolidEdgeAddIn
    Implements SolidEdgeFramework.ISEApplicationEvents
    Implements SolidEdgeFramework.ISEAddInEvents

    Private pAppEvents As SolidEdgeFramework.ISEApplicationEvents_Event
    Private pAddInEvents As SolidEdgeFramework.ISEAddInEvents_Event

 

    Public Overrides Sub OnConnection(application As SolidEdgeFramework.Application, ConnectMode As SolidEdgeFramework.SeConnectMode, AddInInstance As SolidEdgeFramework.AddIn)
        ' If you makes changes to your ribbon, be sure to increment the GuiVersion or your ribbon
        ' will not initialize properly.
        pAppEvents = application.ApplicationEvents
        AddHandler pAppEvents.AfterCommandRun, AddressOf AfterCommandRun

        pAddInEvents = MyAddIn.Instance.AddInEvents
        AddHandler pAddInEvents.OnCommandHelp, AddressOf OnCommandHelp


        AddInEx.GuiVersion = 2
    End Sub


    Public Sub OnCommandHelp(hFrameWnd As Integer, HelpCommandID As Integer, CommandID As Integer) Implements SolidEdgeFramework.ISEAddInEvents.OnCommandHelp
        MsgBox("Help for : " & CommandID )
    End Sub

 

Hope this can help you find where I'm wrong.Smiley Very Happy


Romuald BERTIN

Re: Add help from chm to add-in buttons

Hi Romuald

I think the OnCommandHelp Event is never fired and is in the API just for comatability reasons.

 

I use the properties of the CommandBarButton object.

Set the HelpFile propertiy to your Help file and the HelpContextId to 1 (must be >0).

Then the help is shown, if the user presses F1 when the ToolTip of the command button is displayed or the user use (SHIFT)F1 and clicks on the button.

 

regards

JB
VS2015, SE ST10
Solution
Solution
Accepted by topic author rbertin
‎08-26-2015 04:32 AM

Re: Add help from chm to add-in buttons

Thanks JB.

 

I managed to make it wotk :

 

Public Class Ruban_Application
    Inherits SolidEdgeCommunity.AddIn.Ribbon

    Private _Infos_AddIn As RibbonButton

    Public Sub New()
        ' Get a reference to the current assembly. This is where the ribbon XML is embedded.
        Dim assembly = System.Reflection.Assembly.GetExecutingAssembly()

        ' Note: In this example, the ribbon XML file has a build action of "Embedded Resource".
        Dim embeddedResourceName = String.Format("{0}.xml", Me.GetType().FullName)
        Me.LoadXml(assembly, embeddedResourceName)

        ' Example of how to bind a local variable to a particular ribbon control.
        _Infos_AddIn = GetButton(100)

        ' Example of how to bind a particular ribbon control click event.
        AddHandler _Infos_AddIn.Help, AddressOf _Infos_AddIn_Help

    End Sub

    Private Sub _Infos_AddIn_Help(control As SolidEdgeCommunity.AddIn.RibbonControl, hWndFrame As System.IntPtr, helpCommandID As Integer)
        Help.ShowHelp(Nothing, Path.combine(AppPath,"Help.chm"), HelpNavigator.TopicId, "1")

    End Sub

 


Romuald BERTIN