Working on a text editor here...
I'm trying to figure out if the user has actually caused any changes in a textbox after a keyboard event has occurred. Obviously if they press a standard keys like, A B C, it will fire, but I'm more interested if there's a way, besides enumerating all possible, non-input options.
I will note that I realize the state of the textbox could be compared before and after, but that seems like it would be a poor use of memory, and CPU time if it was a large document. Also, I'm using the Modified
property for another purpose, and since it only fires when it changes, that also isn't an options, as it will more often than not be in the true
state.
I've though about the enumeration side, but that also seems inefficient, as, I would not only have to ensure that every non-input option is there, but also check for all the exceptions. One example that comes to mind:
If Ctrl is pressed, I don't want to do anything, unless I have Ctrl + V or Ctrl + X.
However, if there's nothing in the clipboard, then Ctrl + V shouldn't do anything, and if nothing is selected, then Ctrl + X shouldn't do anything.
I'm sure there are more exceptions that I'm not thinking of right now.
As for the Modified property, when that changes I'm using it to modify the widow title with/without an asterisk based on it's state. So if I reset the property, it will remove the asterisk.