Issue #937: * disable the call to Tree.SetFocus in TBaseVirtualTree.DoEndEdit, which ends the grid editor when tabbed into a new cell. See de863b4417

* reveal exception messages happening in the main control's WindowProc to the SQL log panel
This commit is contained in:
Ansgar Becker
2020-07-17 07:47:52 +02:00
parent 9abdbb5993
commit bcce290a57
2 changed files with 18 additions and 1 deletions

View File

@ -19881,7 +19881,10 @@ begin
FOnEdited(Self, FFocusedNode, FEditColumn); FOnEdited(Self, FFocusedNode, FEditColumn);
end; end;
DoStateChange([], [tsEditPending]); 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; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------

View File

@ -22,6 +22,7 @@ type
TBaseGridEditorLink = class(TInterfacedObject, IVTEditLink) TBaseGridEditorLink = class(TInterfacedObject, IVTEditLink)
private private
FInstanceId: Integer;
FParentForm: TWinControl; // A back reference to the main form FParentForm: TWinControl; // A back reference to the main form
FTree: TVirtualStringTree; // A back reference to the tree calling. FTree: TVirtualStringTree; // A back reference to the tree calling.
FNode: PVirtualNode; // The node to be edited. FNode: PVirtualNode; // The node to be edited.
@ -38,6 +39,7 @@ type
FModified: Boolean; FModified: Boolean;
FAllowEdit: Boolean; FAllowEdit: Boolean;
FBeginEditTime: Cardinal; FBeginEditTime: Cardinal;
procedure Log(Msg: String);
procedure TempWindowProc(var Message: TMessage); procedure TempWindowProc(var Message: TMessage);
procedure DoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure DoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure DoEndEdit(Sender: TObject); procedure DoEndEdit(Sender: TObject);
@ -219,6 +221,9 @@ var
implementation implementation
uses
main;
procedure TAllKeysRadioButton.WMGetDlgCode(var Msg: TMessage); procedure TAllKeysRadioButton.WMGetDlgCode(var Msg: TMessage);
begin begin
@ -233,6 +238,11 @@ begin
Msg.Result := Msg.Result or DLGC_WANTALLKEYS; Msg.Result := Msg.Result or DLGC_WANTALLKEYS;
end; end;
procedure TBaseGridEditorLink.Log(Msg: String);
begin
MainForm.LogSQL('#'+FInstanceId.ToString+': '+Msg);
end;
constructor TBaseGridEditorLink.Create; constructor TBaseGridEditorLink.Create;
begin begin
@ -243,6 +253,7 @@ end;
constructor TBaseGridEditorLink.Create(Tree: TVirtualStringTree; AllowEdit: Boolean); constructor TBaseGridEditorLink.Create(Tree: TVirtualStringTree; AllowEdit: Boolean);
begin begin
inherited Create; inherited Create;
FInstanceId := Random(100);
FTree := Tree; FTree := Tree;
// Enable mouse scrolling, plus ensure the editor component // Enable mouse scrolling, plus ensure the editor component
// is not partly hidden when it pops up in a bottom cell // is not partly hidden when it pops up in a bottom cell
@ -363,6 +374,9 @@ begin
FOldWindowProc(Message); FOldWindowProc(Message);
except except
// EAccessViolation occurring in some cases // 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; end;
end; end;