mirror of https://gitlab.com/basile.b/dexed.git
add TListItems.findCaption overload for simple and full lookups
This commit is contained in:
parent
3998474470
commit
2ebcfcc4ce
|
@ -13,7 +13,7 @@ uses
|
|||
ExtCtrls, FileUtil,
|
||||
{$ENDIF}
|
||||
{$IFNDEF CEBUILD}
|
||||
forms,
|
||||
forms, ComCtrls,
|
||||
{$ENDIF}
|
||||
LazFileUtils, process, asyncprocess, ghashmap, ghashset, LCLIntf, strutils,
|
||||
xfpjson;
|
||||
|
@ -96,6 +96,10 @@ type
|
|||
function findAny(const key: TJSONStringType; out value: TJSONData): boolean;
|
||||
end;
|
||||
|
||||
TListItemsHelper = class helper for TListItems
|
||||
function findCaption(const value: string; out res: TListItem): boolean; overload;
|
||||
end;
|
||||
|
||||
(**
|
||||
* TProcess with assign() 'overriden'.
|
||||
*)
|
||||
|
@ -511,6 +515,19 @@ begin
|
|||
result := value.isNotNil;
|
||||
end;
|
||||
|
||||
function TListItemsHelper.findCaption(const value: string; out res: TListItem): boolean;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
result := false;
|
||||
for i := 0 to self.Count-1 do
|
||||
begin
|
||||
res := self.Item[i];
|
||||
if res.Caption = value then
|
||||
exit(true);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProcessEx.Assign(value: TPersistent);
|
||||
var
|
||||
src: TProcess;
|
||||
|
|
Loading…
Reference in New Issue