Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/10 14:38:15 (14 years ago)
Author:
epitzer
Message:

use SharpDevelop's TextArea.KeyEventHandler to prevent editing before Prefix and after Suffix (#842)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CodeEditor/3.2/CodeEditor.cs

    r2667 r2673  
    169169        return;
    170170
    171       textEditor.ActiveTextAreaControl.TextArea.KeyDown += new System.Windows.Forms.KeyEventHandler(TextArea_KeyDown);
     171      textEditor.ActiveTextAreaControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(TextArea_KeyEventHandler);
    172172      textEditor.ActiveTextAreaControl.TextArea.DoProcessDialogKey += new DialogKeyProcessor(TextArea_DoProcessDialogKey);
    173173
     
    191191    }
    192192
    193     void TextArea_KeyDown(object sender, KeyEventArgs e) {
    194       int caretOffset = textEditor.ActiveTextAreaControl.Caret.Offset;
    195       if (caretOffset == 0 || caretOffset == Doc.TextLength)
    196         e.Handled = true;
     193    #region keyboard handlers: filter input in read-only areas
     194
     195    bool TextArea_KeyEventHandler(char ch) {
     196      int caret = textEditor.ActiveTextAreaControl.Caret.Offset;
     197      return caret < prefix.Length || caret > Doc.TextLength - suffix.Length;
    197198    }
    198199
     
    207208      return false;
    208209    }
     210
     211    #endregion
    209212
    210213    public void ScrollAfterPrefix() {
Note: See TracChangeset for help on using the changeset viewer.