//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "FileListBoxIndexOf.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: FileListBoxIndexOf
// Event: FileCtrl.TDirectoryListBox.OnChange
// Method: Classes.TStrings.IndexOf
// Class: FileCtrl.TDirectoryListBox
// Class: FileCtrl.TFileListBox

// BeginCode
/*
This example uses a file list box, a directory list box, and
a label on a form. When the user uses the directory list box
to change directories, a message appears and the color of
the form changes if the file AUTOEXEC.BAT is in the new
directory. The code is written in the OnChange event of the
directory list box:
*/
void __fastcall TForm1::DirectoryListBox1Change(TObject *Sender)
{
  FileListBox1->Directory = DirectoryListBox1->Directory;
  if (FileListBox1->Items->IndexOf("AUTOEXEC.BAT") > -1)
  {
    Color = clYellow;
    Label1->Caption = "You are in the root directory!";
  }
}
// EndCode
// EndExample: FileListBoxIndexOf
//---------------------------------------------------------------------------
