From af8f77fb8241cd331a4390190c63c8a6ebfc9505 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 14 Mar 2009 16:01:51 +0000 Subject: [PATCH] lcl: TTreeView fixes by Anton Kavalenka - call OnGetImageIndex, OnGetSelectedIndex when we need them, - don't start text editing when we click on icon (issue #0013325) git-svn-id: trunk@18990 - --- lcl/include/treeview.inc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lcl/include/treeview.inc b/lcl/include/treeview.inc index 7eedc6e2ff..f1c8ae8446 100644 --- a/lcl/include/treeview.inc +++ b/lcl/include/treeview.inc @@ -10,7 +10,7 @@ * * * This file is part of the Lazarus Component Library (LCL) * * * - * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * * for details about the copyright. * * * * This program is distributed in the hope that it will be useful, * @@ -4446,13 +4446,19 @@ begin // draw icon if (Images<>nil) and PaintImages then begin - if FSelectedNode<>Node then - ImgIndex:=Node.ImageIndex + if FSelectedNode <> Node then + begin + GetImageIndex(Node); + ImgIndex := Node.ImageIndex + end else - ImgIndex:=Node.SelectedIndex; - if (ImgIndex>=0) and (ImgIndex= 0) and (ImgIndex < Images.Count) then + Images.Draw(Canvas, x + 1, NodeRect.Top, ImgIndex, True); + inc(x, Images.Width + 2); end; // draw state icon @@ -4661,7 +4667,7 @@ begin and (LogicalX expand/collapse CursorNode.Expanded:=not CursorNode.Expanded; - end else if LogicalX>=CursorNode.DisplayIconLeft then begin + end else if LogicalX>=CursorNode.DisplayTextLeft then begin // mousedown occured in text or icon // -> select node and begin drag operation {$IFDEF VerboseDrag}