From dfb86d5ae38b23a1942b710d578bf22b1571ef61 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 25 Feb 2026 13:05:35 +0100 Subject: [PATCH] fix: status bar text gets written into the panel right besides the current one, on Linux/macOS TextRect does not automatically clip on all widgetsets unless you tell it to. On Linux/macOS you must set Canvas.TextStyle so clipping is enabled. --- source/main.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/main.pas b/source/main.pas index 48f5776d..515b61b3 100644 --- a/source/main.pas +++ b/source/main.pas @@ -1508,6 +1508,7 @@ var PanelRect: TRect; ImageIndex: Integer; Conn: TDBConnection; + TS: TTextStyle; begin // Refresh one status bar panel, probably with icon ImageIndex := -1; @@ -1532,6 +1533,11 @@ begin ImageListMain.DrawForControl(StatusBar.Canvas, PanelRect.Left, PanelRect.Top+2, ImageIndex, ImageListMain.Width, StatusBar); OffsetRect(PanelRect, Scale96ToForm(ImageListMain.Width)+4, 0); end; + // Enable clipping, so a longer text does not get written into the panel right besides this one + // If we'd write StatusBar.Canvas.TextStyle.Clipping := True;, we only modify the temporary copy and the change is lost immediately + TS := StatusBar.Canvas.TextStyle; // get record copy + TS.Clipping := True; // modify + StatusBar.Canvas.TextStyle := TS; // write back StatusBar.Canvas.TextRect(PanelRect, PanelRect.Left, PanelRect.Top+2, Panel.Text); end;