mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 08:39:50 +01: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;
|
FOnAdvancedCustomDrawSubItem: TLVAdvancedCustomDrawSubItemEvent;
|
||||||
FProperties: TListViewProperties;
|
FProperties: TListViewProperties;
|
||||||
function GetBoundingRect: TRect;
|
function GetBoundingRect: TRect;
|
||||||
|
function GetColumnCount: Integer;
|
||||||
function GetColumnFromIndex(AIndex: Integer): TListColumn;
|
function GetColumnFromIndex(AIndex: Integer): TListColumn;
|
||||||
function GetDropTarget: TListItem;
|
function GetDropTarget: TListItem;
|
||||||
function GetFocused: TListItem;
|
function GetFocused: TListItem;
|
||||||
@ -1155,6 +1156,7 @@ type
|
|||||||
property Canvas: TCanvas read FCanvas;
|
property Canvas: TCanvas read FCanvas;
|
||||||
property Checkboxes: Boolean index Ord(lvpCheckboxes) read GetProperty write SetProperty default False;
|
property Checkboxes: Boolean index Ord(lvpCheckboxes) read GetProperty write SetProperty default False;
|
||||||
property Column[AIndex: Integer]: TListColumn read GetColumnFromIndex;
|
property Column[AIndex: Integer]: TListColumn read GetColumnFromIndex;
|
||||||
|
property ColumnCount: Integer read GetColumnCount;
|
||||||
property DropTarget: TListItem read GetDropTarget write SetDropTarget;
|
property DropTarget: TListItem read GetDropTarget write SetDropTarget;
|
||||||
property FlatScrollBars: Boolean index Ord(lvpFlatScrollBars) read GetProperty write SetProperty default False;
|
property FlatScrollBars: Boolean index Ord(lvpFlatScrollBars) read GetProperty write SetProperty default False;
|
||||||
property FullDrag: Boolean index Ord(lvpFullDrag) 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);
|
else Result := TWSCustomListViewClass(WidgetSetClass).GetBoundingRect(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomListView.GetColumnCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := FColumns.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomListView.GetColumnFromIndex(AIndex: Integer): TListColumn;
|
function TCustomListView.GetColumnFromIndex(AIndex: Integer): TListColumn;
|
||||||
begin
|
begin
|
||||||
Result := FColumns[AIndex];
|
Result := FColumns[AIndex];
|
||||||
|
|||||||
@ -678,7 +678,7 @@ begin
|
|||||||
// We will therefore postpone all autosizing until EndUpdate where we do
|
// We will therefore postpone all autosizing until EndUpdate where we do
|
||||||
// it only once per column.
|
// 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);
|
ListView_SetColumnWidth(ALV.Handle, ASubIndex, AutoSizeWidth);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user