• Login
Community
  • Login

How to detect ESC keypressed ?

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
notificationeventkeypressed
4 Posts 3 Posters 907 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    morbac
    last edited by Feb 14, 2020, 9:00 AM

    Hi,

    Do you know if and how I can be notified when ESC key is pressed ?

    I tried SCN_CHARADDED, SCN_MODIFIED, SCN_KEY + some other scintilla notification codes, but none of them is invoked when ESC is pressed. I couldn’t find any NPPN_* notification which looks useful for that too.

    Any suggestion ?
    Thanks

    E 1 Reply Last reply Feb 14, 2020, 12:33 PM Reply Quote 1
    • E
      Ekopalypse @morbac
      last edited by Ekopalypse Feb 14, 2020, 12:34 PM Feb 14, 2020, 12:33 PM

      @morbac

      to quote from scintilla

      SCN_KEY
      Reports all keys pressed but not consumed by Scintilla. Used on GTK because of some problems with keyboard focus and is not sent by the Windows version.

      At the moment I only see the way to either register a low level keyboard hook or hooking npps message queue in general.

      1 Reply Last reply Reply Quote 4
      • D
        dail
        last edited by Feb 15, 2020, 2:15 PM

        In the BetterMultiSelection plugin I’ve used SetWindowsHookEx() to hook the keyboard and catch the escape key (along with other keys) before they are sent to Notepad++.

        See https://github.com/dail8859/BetterMultiSelection/blob/master/src/Main.cpp

        1 Reply Last reply Reply Quote 4
        • M
          morbac
          last edited by Feb 18, 2020, 4:17 PM

          Thanks you both for your help.

          I followed your suggestion (low level keyboard hook) and I can now handle ESC key pressed.

          Best Regards

          1 Reply Last reply Reply Quote 3
          • E Ekopalypse referenced this topic on May 20, 2022, 7:44 AM
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors