Skip to content

Commit 8642274

Browse files
committed
Introduced new alias type TNodeHeight and set it to TNativeInt to fix issue #1260.
1 parent 239928b commit 8642274

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Source/VirtualTrees.BaseTree.pas

+6-6
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
757757
function GetFullyVisible(Node: PVirtualNode): Boolean;
758758
function GetHasChildren(Node: PVirtualNode): Boolean;
759759
function GetMultiline(Node: PVirtualNode): Boolean;
760-
function GetNodeHeight(Node: PVirtualNode): TDimension;
760+
function GetNodeHeight(Node: PVirtualNode): TNodeHeight;
761761
function GetNodeParent(Node: PVirtualNode): PVirtualNode;
762762
function GetOffsetXY: TPoint;
763763
function GetRootNodeCount: Cardinal;
@@ -814,7 +814,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
814814
procedure SetMultiline(Node: PVirtualNode; const Value: Boolean);
815815
procedure SetNodeAlignment(const Value: TVTNodeAlignment);
816816
procedure SetNodeDataSize(Value: Integer);
817-
procedure SetNodeHeight(Node: PVirtualNode; Value: TDimension);
817+
procedure SetNodeHeight(Node: PVirtualNode; Value: TNodeHeight);
818818
procedure SetNodeParent(Node: PVirtualNode; const Value: PVirtualNode);
819819
procedure SetOffsetX(const Value: TDimension);
820820
procedure SetOffsetXY(const Value: TPoint);
@@ -1606,7 +1606,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
16061606
property IsFiltered[Node: PVirtualNode]: Boolean read GetFiltered write SetFiltered;
16071607
property IsVisible[Node: PVirtualNode]: Boolean read GetVisible write SetVisible;
16081608
property MultiLine[Node: PVirtualNode]: Boolean read GetMultiline write SetMultiline;
1609-
property NodeHeight[Node: PVirtualNode]: TDimension read GetNodeHeight write SetNodeHeight;
1609+
property NodeHeight[Node: PVirtualNode]: TNodeHeight read GetNodeHeight write SetNodeHeight;
16101610
property NodeParent[Node: PVirtualNode]: PVirtualNode read GetNodeParent write SetNodeParent;
16111611
property OffsetX: TDimension read FOffsetX write SetOffsetX;
16121612
property OffsetXY: TPoint read GetOffsetXY write SetOffsetXY;
@@ -3289,7 +3289,7 @@ function TBaseVirtualTree.GetMultiline(Node: PVirtualNode): Boolean;
32893289

32903290
//----------------------------------------------------------------------------------------------------------------------
32913291

3292-
function TBaseVirtualTree.GetNodeHeight(Node: PVirtualNode): TDimension;
3292+
function TBaseVirtualTree.GetNodeHeight(Node: PVirtualNode): TNodeHeight;
32933293

32943294
begin
32953295
if Assigned(Node) and (Node <> FRoot) then
@@ -4468,7 +4468,7 @@ procedure TBaseVirtualTree.SetChildCount(Node: PVirtualNode; NewChildCount: Card
44684468
Index: Cardinal;
44694469
Child: PVirtualNode;
44704470
Count: Integer;
4471-
NewHeight: TDimension;
4471+
NewHeight: TNodeHeight;
44724472
begin
44734473
if not (toReadOnly in FOptions.MiscOptions) then
44744474
begin
@@ -5052,7 +5052,7 @@ procedure TBaseVirtualTree.SetNodeDataSize(Value: Integer);
50525052

50535053
//----------------------------------------------------------------------------------------------------------------------
50545054

5055-
procedure TBaseVirtualTree.SetNodeHeight(Node: PVirtualNode; Value: TDimension);
5055+
procedure TBaseVirtualTree.SetNodeHeight(Node: PVirtualNode; Value: TNodeHeight);
50565056

50575057
var
50585058
Difference: TDimension;

Source/VirtualTrees.Types.pas

+8-7
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@ interface
127127
{$IFDEF VT_FMX}
128128
TDimension = Single;
129129
PDimension = ^Single;
130+
TNodeHeight = Single;
130131
TVTCursor = TCursor;
131132
TVTDragDataObject = TDragObject;
132133
TVTBackground = TBitmap;
133134
TVTPaintContext = TCanvas;
134135
TVTBrush = TBrush;
135136
{$ELSE}
136-
TDimension = Integer; // For Firemonkey support, see #841
137+
TDimension = Integer; // Introduced for Firemonkey support, see #841
137138
PDimension = ^Integer;
139+
TNodeHeight = NativeInt;
138140
TVTCursor = HCURSOR;
139141
IDataObject= WinApi.ActiveX.IDataObject;
140142
TVTDragDataObject = IDataObject;
@@ -889,16 +891,15 @@ TScrollBarOptions = class(TPersistent)
889891
private
890892
fIndex: Cardinal; // index of node with regard to its parent
891893
fChildCount: Cardinal; // number of child nodes
892-
fNodeHeight: TDimension; // height in pixels
894+
fNodeHeight: TNodeHeight; // height in pixels
893895
public
894896
States: TVirtualNodeStates; // states describing various properties of the node (expanded, initialized etc.)
895897
Align: Byte; // line/button alignment
896898
CheckState: TCheckState; // indicates the current check state (e.g. checked, pressed etc.)
897899
CheckType: TCheckType; // indicates which check type shall be used for this node
898900
Dummy: Byte; // dummy value to fill DWORD boundary
899901
TotalCount: Cardinal; // sum of this node, all of its child nodes and their child nodes etc.
900-
TotalHeight: TDimension; // height in pixels this node covers on screen including the height of all of its
901-
// children
902+
TotalHeight: TNodeHeight;// height in pixels this node covers on screen including the height of all of its children.
902903
_Filler: TDWordFiller; // Ensure 8 Byte alignment of following pointers for 64bit builds. Issue #1136
903904
// Note: Some copy routines require that all pointers (as well as the data area) in a node are
904905
// located at the end of the node! Hence if you want to add new member fields (except pointers to internal
@@ -919,14 +920,14 @@ TScrollBarOptions = class(TPersistent)
919920
procedure SetLastChild(const pLastChild: PVirtualNode); inline; //internal method, do not call directly
920921
procedure SetIndex(const pIndex: Cardinal); inline; //internal method, do not call directly.
921922
procedure SetChildCount(const pCount: Cardinal); inline; //internal method, do not call directly.
922-
procedure SetNodeHeight(const pNodeHeight: TDimension); inline; //internal method, do not call directly.
923+
procedure SetNodeHeight(const pNodeHeight: TNodeHeight); inline; //internal method, do not call directly.
923924
property Index: Cardinal read fIndex;
924925
property ChildCount: Cardinal read fChildCount;
925926
property Parent: PVirtualNode read fParent;
926927
property PrevSibling: PVirtualNode read fPrevSibling;
927928
property NextSibling: PVirtualNode read fNextSibling;
928929
property LastChild: PVirtualNode read fLastChild;
929-
property NodeHeight: TDimension read fNodeHeight;
930+
property NodeHeight: TNodeHeight read fNodeHeight;
930931
private
931932
Data: record end; // this is a placeholder, each node gets extra data determined by NodeDataSize
932933
public
@@ -1153,7 +1154,7 @@ function TVirtualNode.IsAssigned: Boolean;
11531154
Exit(@Self <> nil);
11541155
end;
11551156

1156-
procedure TVirtualNode.SetNodeHeight(const pNodeHeight: TDimension);
1157+
procedure TVirtualNode.SetNodeHeight(const pNodeHeight: TNodeHeight);
11571158
begin
11581159
fNodeHeight := pNodeHeight;
11591160
end;

0 commit comments

Comments
 (0)