TVideoGrabber.FindIndexInListByName

Prev

Next

TVideoGrabber

Methods

 




































































































Search the index of an item in a list of strings, by name or substring


Declaration
function FindIndexInListByName(List: String; SearchedString: String; IsSubString: boolean; IgnoreCase: Boolean): LongInt;


int __fastcall FindIndexInListByName(UnicodeString List, UnicodeString SearchedString, bool IsSubString, bool IgnoreCase)


Function FindIndexInListByName(List As String, SearchedString As String, IsSubString As Boolean, IgnoreCase As Boolean) As Long

Description

Used to find the index of an item in a list of strings, searching by the name of the item or a substring that identifies the item.

E.g., for a given video capture device, the VideoInputs list returns:
Composite
SVideo
Tuner

Therefore the index of "Composite" is 0, the index of "SVideo" in 1, and the index of "Tuner" is 2.

E.g. to programmatically select the "Composite" input. Proceed as follows:

procedure TfrmMainForm.Button1Click(Sender: TObject);
var
   i: LongInt;
begin
   i := VideoGrabber.FindIndexInListByName (VideoGrabber.VideoInputs, 'Composite', false, true);
   if i > -1 then begin  // if this input exists...
      VideoGrabber.VideoInput := i;
   end;
end;


Or to select the same input by using only "Compos" as substring of the input name:

procedure TfrmMainForm.Button1Click(Sender: TObject);
var
   i: LongInt;
begin
   i := VideoGrabber.FindIndexInListByName (VideoGrabber.VideoInputs, 'Compos', true, true);
   if i > -1 then begin  // if this input exists...
      VideoGrabber.VideoInput := i;
   end;
end;


See Also
OnVideoDeviceSelected StoreDeviceSettingsInRegistry