Creating events for another control to process; how may I?
-
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, =]
-
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, =]
Hi, one of these should help you out: Control.IsInputKey() or Control.ProcessCmdKey() Can't remember which exactly. :)
-
Hi, one of these should help you out: Control.IsInputKey() or Control.ProcessCmdKey() Can't remember which exactly. :)
-
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, =]
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 :)