mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #935: cancel editing in grids other than query result grids, when main page control tab changes. Fixes crash when changing tab while editing a column via table editor.
This commit is contained in:
@ -51,6 +51,7 @@ type
|
|||||||
// The right constructor, we need the Tree reference
|
// The right constructor, we need the Tree reference
|
||||||
constructor Create(Tree: TVirtualStringTree; AllowEdit: Boolean); overload; virtual;
|
constructor Create(Tree: TVirtualStringTree; AllowEdit: Boolean); overload; virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property Tree: TVirtualStringTree read FTree;
|
||||||
function PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean; virtual; stdcall;
|
function PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean; virtual; stdcall;
|
||||||
function BeginEdit: Boolean; virtual; stdcall;
|
function BeginEdit: Boolean; virtual; stdcall;
|
||||||
function CancelEdit: Boolean; virtual; stdcall;
|
function CancelEdit: Boolean; virtual; stdcall;
|
||||||
@ -213,6 +214,8 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
ActiveGridEditor: TBaseGridEditorLink;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -249,6 +252,7 @@ begin
|
|||||||
SendMessage(FParentForm.Handle, WM_SETREDRAW, 0, 0);
|
SendMessage(FParentForm.Handle, WM_SETREDRAW, 0, 0);
|
||||||
FModified := False;
|
FModified := False;
|
||||||
FAllowEdit := AllowEdit;
|
FAllowEdit := AllowEdit;
|
||||||
|
ActiveGridEditor := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TBaseGridEditorLink.Destroy;
|
destructor TBaseGridEditorLink.Destroy;
|
||||||
@ -258,6 +262,7 @@ var
|
|||||||
DoPrev: Boolean;
|
DoPrev: Boolean;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
ActiveGridEditor := nil;
|
||||||
if FLastKeyDown = VK_TAB then begin
|
if FLastKeyDown = VK_TAB then begin
|
||||||
DoPrev := ssShift in FLastShiftState;
|
DoPrev := ssShift in FLastShiftState;
|
||||||
// Advance to next/previous visible column/node.
|
// Advance to next/previous visible column/node.
|
||||||
|
@ -5618,13 +5618,14 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TMainForm.PageControlMainChanging(Sender: TObject; var AllowChange: Boolean);
|
procedure TMainForm.PageControlMainChanging(Sender: TObject; var AllowChange: Boolean);
|
||||||
var
|
|
||||||
Grid: TVirtualStringTree;
|
|
||||||
begin
|
begin
|
||||||
// Leave editing mode on tab changes so the editor does not stay somewhere
|
// Leave editing mode on tab changes so the editor does not stay somewhere
|
||||||
Grid := ActiveGrid;
|
if Assigned(ActiveGridEditor)
|
||||||
if Assigned(Grid) and Grid.IsEditing then
|
and Assigned(ActiveGridEditor.Tree)
|
||||||
Grid.CancelEditNode;
|
and ActiveGridEditor.Tree.IsEditing then begin
|
||||||
|
LogSQL('Cancelling tree edit mode on '+ActiveGridEditor.Tree.Name, lcDebug);
|
||||||
|
ActiveGridEditor.Tree.CancelEditNode;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user