Mark grid nodes with vsMultiLine, even if asGridRowLineCount option is set to 1. Fixes endlessly received WM_PAINT messages on results with large lines and tabs in it. Fixes issue #1897. See https://www.heidisql.com/forum.php?t=41502

This commit is contained in:
Ansgar Becker
2024-05-09 13:03:50 +02:00
parent 6c89405813
commit 6e9be764fd
2 changed files with 12 additions and 6 deletions

View File

@ -1416,7 +1416,8 @@ begin
Node := VT.GetFirstInitialized; Node := VT.GetFirstInitialized;
while Assigned(Node) do begin while Assigned(Node) do begin
VT.NodeHeight[Node] := VT.DefaultNodeHeight; VT.NodeHeight[Node] := VT.DefaultNodeHeight;
VT.MultiLine[Node] := MultiLineCount > 1; // Nodes have vsMultiLine through InitNode event
// VT.MultiLine[Node] := MultiLineCount > 1;
Node := VT.GetNextInitialized(Node); Node := VT.GetNextInitialized(Node);
end; end;
VT.EndUpdate; VT.EndUpdate;

View File

@ -6227,11 +6227,9 @@ procedure TMainForm.AnyGridInitNode(Sender: TBaseVirtualTree; ParentNode, Node:
var var
Idx: PInt64; Idx: PInt64;
begin begin
// Display multiline grid rows // Mark all nodes as multiline capable. Fixes painting issues with long lines.
if AppSettings.ReadInt(asGridRowLineCount) = 1 then // See issue #1897 and https://www.heidisql.com/forum.php?t=41502
Exclude(Node.States, vsMultiLine) Include(Node.States, vsMultiLine);
else
Include(Node.States, vsMultiLine);
// Node may have data already, if added via InsertRow // Node may have data already, if added via InsertRow
if not (vsOnFreeNodeCallRequired in Node.States) then begin if not (vsOnFreeNodeCallRequired in Node.States) then begin
Idx := Sender.GetNodeData(Node); Idx := Sender.GetNodeData(Node);
@ -10241,11 +10239,14 @@ var
begin begin
if Column = -1 then if Column = -1 then
Exit; Exit;
if TextType <> ttNormal then
Exit;
ResultCol := Column - 1; ResultCol := Column - 1;
if ResultCol < 0 then begin if ResultCol < 0 then begin
CellText := (Node.Index +1).ToString; CellText := (Node.Index +1).ToString;
Exit; Exit;
end; end;
EditingAndFocused := Sender.IsEditing and (Node = Sender.FocusedNode) and (Column = Sender.FocusedColumn); EditingAndFocused := Sender.IsEditing and (Node = Sender.FocusedNode) and (Column = Sender.FocusedColumn);
Results := GridResult(Sender); Results := GridResult(Sender);
if (Results = nil) or (not Results.Connection.Active) then begin if (Results = nil) or (not Results.Connection.Active) then begin
@ -10255,6 +10256,7 @@ begin
// Happens in some crashes, see issue #2462 // Happens in some crashes, see issue #2462
if ResultCol >= Results.ColumnCount then if ResultCol >= Results.ColumnCount then
Exit; Exit;
RowNumber := Sender.GetNodeData(Node); RowNumber := Sender.GetNodeData(Node);
Results.RecNo := RowNumber^; Results.RecNo := RowNumber^;
if Results.IsNull(ResultCol) and (not EditingAndFocused) then if Results.IsNull(ResultCol) and (not EditingAndFocused) then
@ -14310,6 +14312,7 @@ begin
on E:Exception do on E:Exception do
ErrorDialog(E.Message); ErrorDialog(E.Message);
end; end;
Done := True;
end; end;
// Sort list tables in idle time, so ListTables.TreeOptions.AutoSort does not crash the list // Sort list tables in idle time, so ListTables.TreeOptions.AutoSort does not crash the list
@ -14317,12 +14320,14 @@ begin
if (PageControlMain.ActivePage = tabDatabase) and (not FListTablesSorted) then begin if (PageControlMain.ActivePage = tabDatabase) and (not FListTablesSorted) then begin
ListTables.SortTree(ListTables.Header.SortColumn, ListTables.Header.SortDirection); ListTables.SortTree(ListTables.Header.SortColumn, ListTables.Header.SortDirection);
FListTablesSorted := True; FListTablesSorted := True;
Done := True;
end; end;
// Re-enable refresh action when application is idle // Re-enable refresh action when application is idle
if (not actRefresh.Enabled) and (FRefreshActionDisabledAt < (GetTickCount - 1000)) then if (not actRefresh.Enabled) and (FRefreshActionDisabledAt < (GetTickCount - 1000)) then
begin begin
actRefresh.Enabled := True; actRefresh.Enabled := True;
Done := True;
end; end;
end; end;