mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user