virtualtreeview: Fix "OffsetRect deprecated" message. Less hints and warnings. Fix compilation of "Advanced" demo.

This commit is contained in:
wp_xyz 2023-06-16 14:22:20 +02:00
parent 11dcf15205
commit ca2b76eaf5
3 changed files with 22 additions and 21 deletions

View File

@ -4160,8 +4160,7 @@ uses
TypInfo, // for migration stuff TypInfo, // for migration stuff
ActnList, ActnList,
StdActns, // for standard action support StdActns, // for standard action support
GraphType, GraphType
LCLProc
{$ifdef EnableAccessible} {$ifdef EnableAccessible}
,laz.VTAccessibilityFactory ,laz.VTAccessibilityFactory
{$endif}; // accessibility helper class {$endif}; // accessibility helper class
@ -5009,7 +5008,7 @@ var
I, W: Integer; I, W: Integer;
Buffer, Buffer,
Line: String; Line: String;
Words: array of String; Words: array of String = nil;
R: TRect; R: TRect;
begin begin
@ -7916,7 +7915,7 @@ procedure TVirtualTreeColumn.LoadFromStream(const Stream: TStream; Version: Inte
var var
Dummy: Integer; Dummy: Integer;
S: String; S: String = '';
begin begin
with Stream do with Stream do
@ -9154,6 +9153,7 @@ var
I, Counter: Integer; I, Counter: Integer;
begin begin
Result := nil;
SetLength(Result, Count); SetLength(Result, Count);
Counter := 0; Counter := 0;
@ -11705,7 +11705,7 @@ procedure TVTHeader.LoadFromStream(const Stream: TStream);
var var
Dummy, Dummy,
Version: Integer; Version: Integer;
S: AnsiString; S: AnsiString = '';
OldOptions: TVTHeaderOptions; OldOptions: TVTHeaderOptions;
begin begin
@ -11808,8 +11808,8 @@ var
Rest, Rest,
MaxDelta, MaxDelta,
Difference: Integer; Difference: Integer;
Constraints, Constraints: array of Integer = nil;
Widths: array of Integer; Widths: array of Integer = nil;
BonusPixel: Boolean; BonusPixel: Boolean;
//--------------- local functions ------------------------------------------- //--------------- local functions -------------------------------------------
@ -24761,7 +24761,7 @@ var
var var
Theme: HTHEME; Theme: HTHEME;
begin begin
Theme := OpenThemeData(Application.Handle, 'Explorer::ItemsView'); Theme := OpenThemeData(Application.{%H-}Handle, 'Explorer::ItemsView');
if not (toFullRowSelect in FOptions.FSelectionOptions) or (toGridExtensions in FOptions.FMiscOptions) then if not (toFullRowSelect in FOptions.FSelectionOptions) or (toGridExtensions in FOptions.FMiscOptions) then
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, LVP_LISTDETAIL, State, InnerRect, nil) DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, LVP_LISTDETAIL, State, InnerRect, nil)
else else
@ -24777,7 +24777,7 @@ begin
{$ifdef Windows} {$ifdef Windows}
if tsUseExplorerTheme in FStates then if tsUseExplorerTheme in FStates then
begin begin
Theme := OpenThemeData(Application.Handle, 'Explorer::TreeView'); Theme := OpenThemeData(Application.{%H-}Handle, 'Explorer::TreeView');
RowRect := Rect(0, PaintInfo.CellRect.Top, FRangeX, PaintInfo.CellRect.Bottom); RowRect := Rect(0, PaintInfo.CellRect.Top, FRangeX, PaintInfo.CellRect.Bottom);
if (Header.Columns.Count = 0) and (toFullRowSelect in TreeOptions.SelectionOptions) then if (Header.Columns.Count = 0) and (toFullRowSelect in TreeOptions.SelectionOptions) then
RowRect.Right := Max(ClientWidth, RowRect.Right); RowRect.Right := Max(ClientWidth, RowRect.Right);
@ -29835,6 +29835,7 @@ var
Counter: Cardinal; Counter: Cardinal;
begin begin
Result := nil;
SetLength(Result, FSelectionCount); SetLength(Result, FSelectionCount);
if FSelectionCount > 0 then if FSelectionCount > 0 then
begin begin
@ -34528,7 +34529,7 @@ var
Alignment: TAlignment; Alignment: TAlignment;
PaintInfo: TVTPaintInfo; PaintInfo: TVTPaintInfo;
Dummy: TColumnIndex; Dummy: TColumnIndex;
LineImage: TLineImage; LineImage: TLineImage = nil;
begin begin
if Length(S) = 0 then if Length(S) = 0 then
S := Text[Node, Column]; S := Text[Node, Column];

View File

@ -382,7 +382,7 @@ begin
pf32bit: pf32bit:
Data.Properties := Data.Properties + ', 16M+ colors'; Data.Properties := Data.Properties + ', 16M+ colors';
end; end;
if Cardinal(Data.Image.Height) + 4 > TVirtualDrawTree(Sender).DefaultNodeHeight then if Cardinal(Data.Image.Height) + 4 > TLazVirtualDrawTree(Sender).DefaultNodeHeight then
Sender.NodeHeight[Node] := Data.Image.Height + 4; Sender.NodeHeight[Node] := Data.Image.Height + 4;
except except
Data.Image.Free; Data.Image.Free;
@ -430,7 +430,7 @@ var
R: TRect; R: TRect;
begin begin
with Sender as TVirtualDrawTree, PaintInfo do with Sender as TLazVirtualDrawTree, PaintInfo do
begin begin
Data := Sender.GetNodeData(Node); Data := Sender.GetNodeData(Node);
if (Column = FocusedColumn) and (Node = FocusedNode) then if (Column = FocusedColumn) and (Node = FocusedNode) then
@ -494,7 +494,7 @@ var
AMargin: Integer; AMargin: Integer;
begin begin
with Sender as TVirtualDrawTree do with Sender as TLazVirtualDrawTree do
AMargin := TextMargin; AMargin := TextMargin;
begin begin
@ -563,7 +563,7 @@ begin
// finally sort node // finally sort node
if ChildCount > 0 then if ChildCount > 0 then
Sender.Sort(Node, 0, TVirtualStringTree(Sender).Header.SortDirection, False); Sender.Sort(Node, 0, TLazVirtualStringTree(Sender).Header.SortDirection, False);
finally finally
FindCloseUTF8(SR); FindCloseUTF8(SR);
Screen.Cursor := crDefault; Screen.Cursor := crDefault;

View File

@ -40,10 +40,10 @@ type
TPropertyEditLink = class(TInterfacedObject, IVTEditLink) TPropertyEditLink = class(TInterfacedObject, IVTEditLink)
private private
FEdit: TWinControl; // One of the property editor classes. FEdit: TWinControl; // One of the property editor classes.
FTree: TVirtualStringTree; // A back reference to the tree calling. FTree: TLazVirtualStringTree; // A back reference to the tree calling.
FNode: PVirtualNode; // The node being edited. FNode: PVirtualNode; // The node being edited.
FColumn: Integer; // The column of the node being edited. FColumn: Integer; // The column of the node being edited.
protected protected
procedure EditExit(Sender: TObject); procedure EditExit(Sender: TObject);
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -216,7 +216,7 @@ begin
end; end;
type type
TVirtualStringTreeAccess = class(TVirtualStringTree); TVirtualStringTreeAccess = class(TLazVirtualStringTree);
procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var var
@ -411,7 +411,7 @@ var
begin begin
Result := True; Result := True;
FTree := Tree as TVirtualStringTree; FTree := Tree as TLazVirtualStringTree;
FNode := Node; FNode := Node;
FColumn := Column; FColumn := Column;
@ -593,7 +593,7 @@ var
TempText: String; TempText: String;
begin begin
Result := True; Result := True;
FTree := Tree as TVirtualStringTree; FTree := Tree as TLazVirtualStringTree;
FNode := Node; FNode := Node;
FColumn := Column; FColumn := Column;