added TListItems.FindCaption partstart parameter

git-svn-id: trunk@7096 -
This commit is contained in:
mattias 2005-04-22 08:19:39 +00:00
parent b045cbd550
commit d3799fa495
3 changed files with 24 additions and 10 deletions

View File

@ -635,7 +635,9 @@ type
constructor Create(AOwner : TCustomListView);
destructor Destroy; override;
procedure Delete(const AIndex : Integer);
function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean): TListItem;
function FindCaption(StartIndex: Integer; Value: string;
Partial, Inclusive, Wrap: Boolean;
PartStart: Boolean{$IFNDEF 1_0} = True{$ENDIF}): TListItem;
function FindData(const AData: Pointer): TListItem;
function Insert(const AIndex: Integer) : TListItem;
procedure InsertItem(AItem: TListItem; const AIndex: Integer);
@ -886,11 +888,11 @@ type
property WidgetSetClass;
{$endif}
public
constructor Create(Aowner: TComponent); override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BeginUpdate;
procedure EndUpdate;
function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean): TListItem;
function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem;
property BoundingRect: TRect read GetBoundingRect;
property Canvas: TCanvas read FCanvas;
property Checkboxes: Boolean index Ord(lvpCheckboxes) read GetProperty write SetProperty {$IFNDEF VER1_0}default False{$ENDIF};
@ -2409,6 +2411,9 @@ end.
{ =============================================================================
$Log$
Revision 1.172 2005/04/22 08:19:39 mattias
added TListItems.FindCaption partstart parameter
Revision 1.171 2005/04/21 16:15:52 mattias
added TListView.FindCaption from Matthijs Willemstein

View File

@ -408,7 +408,7 @@ begin
end;
function TCustomListView.FindCaption(StartIndex: Integer; Value: string;
Partial, Inclusive, Wrap: Boolean): TListItem;
Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem;
begin
Result := FListItems.FindCaption(StartIndex, Value, Partial, Inclusive, Wrap);
end;
@ -752,6 +752,9 @@ end;
{ =============================================================================
$Log$
Revision 1.46 2005/04/22 08:19:39 mattias
added TListItems.FindCaption partstart parameter
Revision 1.45 2005/04/21 16:15:52 mattias
added TListView.FindCaption from Matthijs Willemstein

View File

@ -252,13 +252,13 @@ end;
{ TListItems FindCaption }
{------------------------------------------------------------------------------}
function TListItems.FindCaption(StartIndex: Integer; Value: string;
Partial, Inclusive, Wrap: Boolean): TListItem;
Partial, Inclusive, Wrap: Boolean; PartStart: Boolean): TListItem;
var
I: Integer;
CaptionFound, AllChecked: Boolean;
begin
result := nil;
if (Count = 0) or (StartIndex > Count) or (not Inclusive and (count = 1)) then Exit;
if (Count = 0) or (StartIndex >= Count) or (not Inclusive and (count = 1)) then Exit;
CaptionFound := False;
AllChecked := False;
if Inclusive then
@ -269,10 +269,13 @@ begin
end;
if Wrap then Wrap := (StartIndex <> 0);
repeat
if not AllChecked then begin
if Partial then CaptionFound := pos(Value, Item[I].Caption) > 0
else CaptionFound := Value = Item[I].Caption;
end;
if Partial then begin
if PartStart then
CaptionFound := pos(Value, Item[I].Caption) = 1
else
CaptionFound := pos(Value, Item[I].Caption) <> 0;
end else
CaptionFound := Value = Item[I].Caption;
if not CaptionFound then begin
Inc(I);
if Wrap then begin
@ -509,6 +512,9 @@ end;
{ =============================================================================
$Log$
Revision 1.30 2005/04/22 08:19:39 mattias
added TListItems.FindCaption partstart parameter
Revision 1.29 2005/04/21 16:15:52 mattias
added TListView.FindCaption from Matthijs Willemstein