mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Fix issue #1156: Table editor, checkbox state change although mouse clicked elsewhere in white space. Same goes for index tree.
This commit is contained in:
@ -946,26 +946,26 @@ var
|
|||||||
VT: TVirtualStringTree;
|
VT: TVirtualStringTree;
|
||||||
Props: TWideStringlist;
|
Props: TWideStringlist;
|
||||||
dt: TMySQLDataTypeRecord;
|
dt: TMySQLDataTypeRecord;
|
||||||
Node: PVirtualNode;
|
Click: THitInfo;
|
||||||
begin
|
begin
|
||||||
// Handle click event
|
// Handle click event
|
||||||
VT := Sender as TVirtualStringTree;
|
VT := Sender as TVirtualStringTree;
|
||||||
if not Assigned(VT.FocusedNode) then
|
VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, Click);
|
||||||
|
if not Assigned(Click.HitNode) then
|
||||||
Exit;
|
Exit;
|
||||||
if VT.FocusedColumn in [4, 5] then begin
|
if Click.HitColumn in [4, 5] then begin
|
||||||
// For checkboxes, cell editors are disabled, instead toggle their state
|
// For checkboxes, cell editors are disabled, instead toggle their state
|
||||||
Props := TWideStringList(Columns.Objects[VT.FocusedNode.Index]);
|
Props := TWideStringList(Columns.Objects[Click.HitNode.Index]);
|
||||||
dt := GetDatatypeByName(Props[0]);
|
dt := GetDatatypeByName(Props[0]);
|
||||||
if dt.HasUnsigned or (VT.FocusedColumn = 5) then begin
|
if dt.HasUnsigned or (Click.HitColumn = 5) then begin
|
||||||
Props[VT.FocusedColumn-2] := BoolToStr(not StrToBool(Props[VT.FocusedColumn-2]));
|
Props[Click.HitColumn-2] := BoolToStr(not StrToBool(Props[Click.HitColumn-2]));
|
||||||
VT.InvalidateNode(VT.FocusedNode);
|
VT.InvalidateNode(Click.HitNode);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
// All other cells go into edit mode please
|
// All other cells go into edit mode please
|
||||||
// Explicitely done on OnClick, not in OnFocusChanged which seemed annoying for keyboard users
|
// Explicitely done on OnClick, not in OnFocusChanged which seemed annoying for keyboard users
|
||||||
Node := VT.GetNodeAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y);
|
if Assigned(Click.HitNode) then
|
||||||
if Assigned(Node) then
|
VT.EditNode(Click.HitNode, Click.HitColumn);
|
||||||
VT.EditNode(Node, VT.FocusedColumn);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1270,15 +1270,13 @@ end;
|
|||||||
procedure TfrmTableEditor.treeIndexesClick(Sender: TObject);
|
procedure TfrmTableEditor.treeIndexesClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
VT: TVirtualStringTree;
|
VT: TVirtualStringTree;
|
||||||
Node: PVirtualNode;
|
Click: THitInfo;
|
||||||
begin
|
begin
|
||||||
// Handle click event
|
// Handle click event
|
||||||
VT := Sender as TVirtualStringTree;
|
VT := Sender as TVirtualStringTree;
|
||||||
if not Assigned(VT.FocusedNode) then
|
VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, Click);
|
||||||
Exit;
|
if Assigned(Click.HitNode) then
|
||||||
Node := VT.GetNodeAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y);
|
VT.EditNode(Click.HitNode, Click.HitColumn);
|
||||||
if Assigned(Node) then
|
|
||||||
VT.EditNode(Node, VT.FocusedColumn);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user