diff --git a/components/virtualtreeview/Source/VirtualTrees.pas b/components/virtualtreeview/Source/VirtualTrees.pas index 78b9e0a3..3acdb5e7 100644 --- a/components/virtualtreeview/Source/VirtualTrees.pas +++ b/components/virtualtreeview/Source/VirtualTrees.pas @@ -19881,7 +19881,10 @@ begin FOnEdited(Self, FFocusedNode, FEditColumn); end; DoStateChange([], [tsEditPending]); - SetFocus(); + // Causes the editor to end prematurely, after having tabbed into a new cell + // see https://github.com/JAM-Software/Virtual-TreeView/commit/de863b4417dfd98caffe8d0c283959b4842d2a82 + // see https://github.com/HeidiSQL/HeidiSQL/issues/937 + //SetFocus(); end; //---------------------------------------------------------------------------------------------------------------------- diff --git a/source/grideditlinks.pas b/source/grideditlinks.pas index 5310a217..f5b1c660 100644 --- a/source/grideditlinks.pas +++ b/source/grideditlinks.pas @@ -22,6 +22,7 @@ type TBaseGridEditorLink = class(TInterfacedObject, IVTEditLink) private + FInstanceId: Integer; FParentForm: TWinControl; // A back reference to the main form FTree: TVirtualStringTree; // A back reference to the tree calling. FNode: PVirtualNode; // The node to be edited. @@ -38,6 +39,7 @@ type FModified: Boolean; FAllowEdit: Boolean; FBeginEditTime: Cardinal; + procedure Log(Msg: String); procedure TempWindowProc(var Message: TMessage); procedure DoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure DoEndEdit(Sender: TObject); @@ -219,6 +221,9 @@ var implementation +uses + main; + procedure TAllKeysRadioButton.WMGetDlgCode(var Msg: TMessage); begin @@ -233,6 +238,11 @@ begin Msg.Result := Msg.Result or DLGC_WANTALLKEYS; end; +procedure TBaseGridEditorLink.Log(Msg: String); +begin + MainForm.LogSQL('#'+FInstanceId.ToString+': '+Msg); +end; + constructor TBaseGridEditorLink.Create; begin @@ -243,6 +253,7 @@ end; constructor TBaseGridEditorLink.Create(Tree: TVirtualStringTree; AllowEdit: Boolean); begin inherited Create; + FInstanceId := Random(100); FTree := Tree; // Enable mouse scrolling, plus ensure the editor component // is not partly hidden when it pops up in a bottom cell @@ -363,6 +374,9 @@ begin FOldWindowProc(Message); except // EAccessViolation occurring in some cases + on E:Exception do begin + Log(E.Message+' Message CharCode:'+TWMChar(Message).CharCode.ToString+' Msg:'+Message.Msg.ToString); + end; end; end; end;