Keydown event in GoTextNode

Hi,
As GoTextNode has no multiline method and keydown event handler,
I can’t contol keycode while editing in GoTextNode objects.
I’d like to stop edit mode when I press “Enter” key if it’s difficult
to be handle in this version.
Thanks in advance

First, I would like to make clear that it isn’t GoTextNode that handles in-place editing – it’s the GoText object that is the GoTextNode.Label that is responsible for deciding what kind of Control that is created for the user to edit with. By default that is a kind of System.Windows.Forms.TextBox, but if you set GoText.EditorStyle to a different value, such as GoTextEditorStyle.ComboBox, then the user will get a System.Windows.Forms.ComboBox.
Secondly, it is the responsibility of a GoControl object to act as the “manager” or “host” for the WinForm Control that is created and added to the GoView. That GoControl object is created by GoText.CreateEditor. CreateEditor is called by GoText.DoBeginEdit which is called by GoText.OnSingleClick and some other event handlers.
I assume you already know that if GoText.Multiline is false an “Enter” key in the TextBox Control will finish the editing and accept the new text string. So you must be asking about changing the behavior of an “Enter” key when GoText.Multiline (and thus TextBox.AcceptsReturn) is true.
So you have two choices: simple modifications to the TextBox Control that GoText creates by default, or your own custom TextBox Control.
For the first choice, you can override GoText.DoBeginEdit, and after calling the base method, you can find and modify the Control in the GoView. Read the documentation for GoText.DoBeginEdit.
For the second choice, you’ll need to define your own TextBox-inheriting Control that does the event-handling that you want. Then you need to override GoText.CreateEditor to do something like:
public override GoControl CreateEditor(GoView view) {
GoControl editor = new GoControl();
editor.ControlType = typeof(CustomTextBox);
editor.Bounds = …; // size/position the Control the way you want
return editor;
}
Your CustomTextBox Control should implement IGoControlObject; the IGoControlObject.GoControl setter can do the initialization of your CustomTextBox. You can read more in the GoText documentation for GoText.CreateEditor and related methods.