How to ignore some input

May 9, 2009 at 11:13 AM
Edited May 9, 2009 at 11:13 AM

The way I'm currently ignoring certain keys is by handling the keypreview event, then if I want to ignore the key I set the readonly to true.

Then next time a key is released I set readonly to false.


Is there a less hackish way to do this :D?

May 9, 2009 at 2:44 PM

I didn't want to open another thread but I have another question.


Let's say I have a selection and I want to uppercase the selection (or perform some other generic operation, alphabetize the words etc). What's the best way to do this?


At the moment all I seem to able to do is to make a copy of the entire text, replace the bit I want, then assign the entire text back to the control. This seems rather wasteful.

May 10, 2009 at 12:46 AM

Probably the easiest way to cancel a keystroke is to handle the KeyDown event (on Scintilla) and set e.Handled = true

For uppercasing the selection

scintilla.Selection.Range.Text = scintilla.Selection.Range.Text.ToUpper();

May 10, 2009 at 6:55 AM

Cool, thanks Chris!