Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating events for another control to process; how may I?

Creating events for another control to process; how may I?

Scheduled Pinned Locked Moved C#
questionhelp
4 Posts 3 Posters 0 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Acshi
    wrote on last edited by
    #1

    I have a menu item with a shortcut key of "del" so that I can do all entry deletion through the item's handler. However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes. At first thought, I wanted to simply go with a sort of, "If editing an entry, then entry.RaiseKeyEvent(key, e), else delete entry," though I can't as RaiseKeyEvent is a protected method. For now, I have simply used my own implementation of what I believe the expected del behavior to be, but would highly prefer to be able to let the control use its own... In case there is a way to solve this problem that by-passes my original question, I also have another case where I would need to do something like this... Thank you for reading this at least, =]

    L L 2 Replies Last reply
    0
    • A Acshi

      I have a menu item with a shortcut key of "del" so that I can do all entry deletion through the item's handler. However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes. At first thought, I wanted to simply go with a sort of, "If editing an entry, then entry.RaiseKeyEvent(key, e), else delete entry," though I can't as RaiseKeyEvent is a protected method. For now, I have simply used my own implementation of what I believe the expected del behavior to be, but would highly prefer to be able to let the control use its own... In case there is a way to solve this problem that by-passes my original question, I also have another case where I would need to do something like this... Thank you for reading this at least, =]

      L Offline
      L Offline
      Luc 648011
      wrote on last edited by
      #2

      Hi, one of these should help you out: Control.IsInputKey() or Control.ProcessCmdKey() Can't remember which exactly. :)

      A 1 Reply Last reply
      0
      • L Luc 648011

        Hi, one of these should help you out: Control.IsInputKey() or Control.ProcessCmdKey() Can't remember which exactly. :)

        A Offline
        A Offline
        Acshi
        wrote on last edited by
        #3

        You can override Control.IsInputKey() for a user control so that the control can handle events for arrow keys or other typical keys, but I'm not seeing that stopping the menu item from using its shortcut key... :~...

        1 Reply Last reply
        0
        • A Acshi

          I have a menu item with a shortcut key of "del" so that I can do all entry deletion through the item's handler. However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes. At first thought, I wanted to simply go with a sort of, "If editing an entry, then entry.RaiseKeyEvent(key, e), else delete entry," though I can't as RaiseKeyEvent is a protected method. For now, I have simply used my own implementation of what I believe the expected del behavior to be, but would highly prefer to be able to let the control use its own... In case there is a way to solve this problem that by-passes my original question, I also have another case where I would need to do something like this... Thank you for reading this at least, =]

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Acshi wrote:

          However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes.

          I had the same problem some time ago and my first solution was to disable the shortcut-key before editing text. That got messy quite fast, and thus I changed the shortcut-key to Ctrl-DEL. I don't know if that's a viable option for your project though :)

          I are troll :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups