web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

NAV2015 Client add-in 'Enter' key not processed

(0) ShareShare
ReportReport
Posted on by

Hi all,

I've upgraded one of our solutions to 2015 to see what's what.
After the upgrade one of our client add-in isn't working correctly anymore. Somehow the 'Enter' key doesn't reach the add-in. Every other key on the keyboard gets through, even pressing 'SHIFT + Enter' but not 'Enter' on it's own.

To be sure I've written a simple add-in with only a TextBox and a KeyDown event attached. But even in that add-in the 'Enter' key from the RTC does not reach the add-in.

protected override Control CreateControl()
{
  TextBox txtTestEvent = new TextBox();
  txtTestEvent.KeyDown += txtTestEvent_KeyDown;
  return txtTestEvent;
}

void txtTestEvent_KeyDown(object sender, KeyEventArgs e)
{
  MessageBox.Show(String.Format("{0} key pressed!", e.KeyCode));
}

Any ideas?

Gr, Erik

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    hi,

    did you set property keypreview to true?

    Check out PreviewKeyDown event. Return raises that event on button controls.

    private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)

       {

           if (e.KeyCode == Keys.Return)

               MessageBox.Show("I found return");

       }

    Or try:

       private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)

       {

           if (e.KeyCode == Keys.Return)

               e.IsInputKey = true;

       }

    best regards

  • Community Member Profile Picture
    on at

    The problem is not handling the enter in the add-in. The enter is not even reaching the add-in from the NAV client. It's like the RTC is somehow blocking the enter for it's own purpose. All other keys reach the add-in.

    And, the same add-in works like a charm in 2009, 2013 and 2013R2.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    so then it sounds like a bug ( = MS feature :-) )

    workaround: add a OK-button to the addin control which simulates an ENTER/Return key event. :-|

  • Community Member Profile Picture
    on at

    It's a rich-text/html editor add-in so an 'enter' button would not be particularly nice :)

    [View:http://demo.abpdynamics.nl/editor.jpg]

    I'll just report a bug.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    maybe this will help you.

    vjeko.com/.../trick-instantiating-any-control-in-a-control-add-in

  • Community Member Profile Picture
    on at

    Hi Erik,

    Does this help you?

    http://blogs.msdn.com/b/nav/archive/2015/01/28/how-to-control-keyboards-events-in-add-in.aspx

    You have made a nice editor. Can I download it somewhere?

  • ChrisWilson Profile Picture
    5 on at

    ErikvR, We have the same problem.. on implementing a text editor addin pressing the return key takes focus out of the control and back on to the NAV page. Did you find a solution to this?

  • Suggested answer
    Community Member Profile Picture
    on at

    Chris, it turned out to be a plain bug in NAV. Since (I think) 2015 CU4 a fix is in place but you do have to modify your add-in assembly. Just implement the 'IControlAddInEnterKeyHandler' interface that's present in the CU4 Microsoft.Dynamics.Framework.UI.Extensibility assembly.

    blogs.msdn.com/.../how-to-control-keyboards-events-in-add-in.aspx

    They describe it as some nice new feature but we all know it worked before and got broken. So it's just a bugfix.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans