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,
|
ExtCtrls, FileUtil,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFNDEF CEBUILD}
|
{$IFNDEF CEBUILD}
|
||||||
forms,
|
forms, ComCtrls,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LazFileUtils, process, asyncprocess, ghashmap, ghashset, LCLIntf, strutils,
|
LazFileUtils, process, asyncprocess, ghashmap, ghashset, LCLIntf, strutils,
|
||||||
xfpjson;
|
xfpjson;
|
||||||
|
@ -96,6 +96,10 @@ type
|
||||||
function findAny(const key: TJSONStringType; out value: TJSONData): boolean;
|
function findAny(const key: TJSONStringType; out value: TJSONData): boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TListItemsHelper = class helper for TListItems
|
||||||
|
function findCaption(const value: string; out res: TListItem): boolean; overload;
|
||||||
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* TProcess with assign() 'overriden'.
|
* TProcess with assign() 'overriden'.
|
||||||
*)
|
*)
|
||||||
|
@ -511,6 +515,19 @@ begin
|
||||||
result := value.isNotNil;
|
result := value.isNotNil;
|
||||||
end;
|
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);
|
procedure TProcessEx.Assign(value: TPersistent);
|
||||||
var
|
var
|
||||||
src: TProcess;
|
src: TProcess;
|
||||||
|
|
Loading…
Reference in New Issue