Link toolbar button to event in code - InfoPath Dev
in

InfoPath Dev

Link toolbar button to event in code

Last post 05-20-2010 02:07 PM by schan. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-11-2008 11:57 PM

    • totoen
    • Not Ranked
    • Joined on 08-12-2008
    • Posts 7

    Link toolbar button to event in code

    Hi,

     I have a form that I want to convert (2003 to 2007) but now the button on my custom toolbar doesn't firing.

     When I click on one of my toolbar button nothing is doing (this was good working before the conversion). Can you help me?

    I use VS 2005,  Infopath 2007 with C#.   

    The declaration in the manifest:

    <xsf:button name="Quit" caption="Abbrechen"></xsf:button>

    The link to the event in the internal startup:

    ((ButtonEvent)EventManager.ControlEvents["Quit"]).Clicked += new ClickedEventHandler(Quit_Clicked);

    the event in my code:

    public void Quit_Clicked(object sender, ClickedEventArgs e)

    {

    MessageBox.Show("Hello world");

    }

    What is wrong ?

    Thanks

  • 08-14-2008 02:05 AM In reply to

    • totoen
    • Not Ranked
    • Joined on 08-12-2008
    • Posts 7

    Re: Link toolbar button to event in code

    Hi,

    Nobody make custom toolbar?

    In this article it's explain how to make custom toolbar:

    http://msdn.microsoft.com/en-us/library/bb251008.aspx

     But nothing is say about how to bind it with the C# code.

    Please help me, Thanks!

     

  • 02-24-2010 02:07 AM In reply to

    • h3rb4l
    • Not Ranked
    • Joined on 02-24-2010
    • Posts 1

    Re: Link toolbar button to event in code

     Hi,

    Is there any progress with this one?

    Have you managed to find any solution?

     

    Regards,

    h3rb4l

    Filed under: , ,
  • 05-20-2010 02:07 PM In reply to

    • schan
    • Not Ranked
    • Joined on 05-20-2010
    • Posts 1

    Re: Link toolbar button to event in code

    I am getting into the same issue. I managed to find a get around, to use InfoPath 2003 object model instead of InfoPath 2007 object model.

    Go to Form, Options and set the Form template code language to C# (InfoPath 2003 Compatible) and add the following code,

    [InfoPathEventHandler(MatchPath = "btnHello", EventType = InfoPathEventType.OnClick)]
    public void btnHello_OnClick(DocActionEvent e)
    {
         thisXDocument.UI.Alert("Hello");
    }

    I'm still trying to find the proper way to use the InfoPath 2007 object model to register the event handler of a custom toolbar button.

    Simon

     

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.