mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:19:22 +02:00
lcl: add public property TCustomListView.ColumnCount,
win32: don't access listview columns array out of it bounds (issue #0017263) git-svn-id: trunk@27199 -
This commit is contained in:
parent
bdf98dfd4f
commit
f20f3aa1ef
@ -1041,6 +1041,7 @@ type
|
||||
FOnAdvancedCustomDrawSubItem: TLVAdvancedCustomDrawSubItemEvent;
|
||||
FProperties: TListViewProperties;
|
||||
function GetBoundingRect: TRect;
|
||||
function GetColumnCount: Integer;
|
||||
function GetColumnFromIndex(AIndex: Integer): TListColumn;
|
||||
function GetDropTarget: TListItem;
|
||||
function GetFocused: TListItem;
|
||||
@ -1155,6 +1156,7 @@ type
|
||||
property Canvas: TCanvas read FCanvas;
|
||||
property Checkboxes: Boolean index Ord(lvpCheckboxes) read GetProperty write SetProperty default False;
|
||||
property Column[AIndex: Integer]: TListColumn read GetColumnFromIndex;
|
||||
property ColumnCount: Integer read GetColumnCount;
|
||||
property DropTarget: TListItem read GetDropTarget write SetDropTarget;
|
||||
property FlatScrollBars: Boolean index Ord(lvpFlatScrollBars) read GetProperty write SetProperty default False;
|
||||
property FullDrag: Boolean index Ord(lvpFullDrag) read GetProperty write SetProperty default False;
|
||||
|
@ -725,6 +725,11 @@ begin
|
||||
else Result := TWSCustomListViewClass(WidgetSetClass).GetBoundingRect(Self);
|
||||
end;
|
||||
|
||||
function TCustomListView.GetColumnCount: Integer;
|
||||
begin
|
||||
Result := FColumns.Count;
|
||||
end;
|
||||
|
||||
function TCustomListView.GetColumnFromIndex(AIndex: Integer): TListColumn;
|
||||
begin
|
||||
Result := FColumns[AIndex];
|
||||
|
@ -678,7 +678,7 @@ begin
|
||||
// We will therefore postpone all autosizing until EndUpdate where we do
|
||||
// it only once per column.
|
||||
|
||||
if ALV.Column[ASubIndex].AutoSize and (TCustomListViewAccess(ALV).GetUpdateCount = 0) then
|
||||
if (ASubIndex >= 0) and (ASubIndex < ALV.ColumnCount) and ALV.Column[ASubIndex].AutoSize and (TCustomListViewAccess(ALV).GetUpdateCount = 0) then
|
||||
ListView_SetColumnWidth(ALV.Handle, ASubIndex, AutoSizeWidth);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user