From 6adef76705442bc23ccf4ec1cf5a05e5d50cd0fe Mon Sep 17 00:00:00 2001 From: blikblum Date: Thu, 24 Dec 2009 12:36:17 +0000 Subject: [PATCH] * Change LM_SETFONT handler to CM_FONTCHANGED so the tree can properly react to font changes git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1082 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../virtualtreeview-new/trunk/VirtualTrees.pas | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/components/virtualtreeview-new/trunk/VirtualTrees.pas b/components/virtualtreeview-new/trunk/VirtualTrees.pas index 61d985d54..9e7c15b04 100644 --- a/components/virtualtreeview-new/trunk/VirtualTrees.pas +++ b/components/virtualtreeview-new/trunk/VirtualTrees.pas @@ -3310,7 +3310,7 @@ type procedure SetDefaultText(const Value: String); procedure SetOptions(const Value: TCustomStringTreeOptions); procedure SetText(Node: PVirtualNode; Column: TColumnIndex; const Value: String); - procedure WMSetFont(var Msg: TLMNoParams{TWMSetFont}); message LM_SETFONT; + procedure CMFontChanged(var Msg: TLMessage); message CM_FONTCHANGED; protected procedure AdjustPaintCellRect(var PaintInfo: TVTPaintInfo; out NextNonEmpty: TColumnIndex); override; function CanExportNode(Node: PVirtualNode): Boolean; @@ -15228,7 +15228,7 @@ begin if HandleAllocated then Invalidate; end; - //todo_lcl Replace this message with a THeader method + HeaderMessage.Msg := CM_PARENTFONTCHANGED; HeaderMessage.WParam := 0; HeaderMessage.LParam := 0; @@ -31565,27 +31565,23 @@ end; //---------------------------------------------------------------------------------------------------------------------- -procedure TCustomVirtualStringTree.WMSetFont(var Msg: TLMNoParams); +procedure TCustomVirtualStringTree.CMFontChanged(var Msg: TLMessage); // Whenever a new font is applied to the tree some default values are determined to avoid frequent // determination of the same value. -{ var MemDC: HDC; Run: PVirtualNode; TM: TTextMetric; Size: TSize; Data: PInteger; -} begin inherited; - //todo_lcl - { MemDC := CreateCompatibleDC(0); try - SelectObject(MemDC, Msg.Font); + SelectObject(MemDC, Font.Reference.Handle); GetTextMetrics(MemDC, TM); FTextHeight := TM.tmHeight; @@ -31604,7 +31600,6 @@ begin Data^ := 0; Run := GetNextNoInit(Run); end; - } end; //----------------------------------------------------------------------------------------------------------------------