event Change (Files as Files)

Fired when the browsed folder has changed its content.

TypeDescription
Files as Files A Files object that contains the list of files that has been changed.

Use the Change event to notify your application whenever the browsed folder's content has been changed, like adding or removing files. The Change event is fired only if the AutoUpdate property is True, and ChangeNotification property is True. Use the State property to determine the new state of the file or folder. Use the Folder property to specify whether the object holds information about a folder of a file. Use the BrowseFolderPath property to indicates the browsed folder. Use the Item property to access a file giving its index in the Files collection. Use the Count property to retrieve the number of File objects in the Files collection.

Syntax for Change event, /NET version, on:

private void Change(object sender,exontrol.EXFILEVIEWLib.Files Files)
{
}

Private Sub Change(ByVal sender As System.Object,ByVal Files As exontrol.EXFILEVIEWLib.Files) Handles Change
End Sub

Syntax for Change event, /COM version, on:

private void Change(object sender, AxEXFILEVIEWLib._IExFileViewEvents_ChangeEvent e)
{
}

void OnChange(LPDISPATCH Files)
{
}

void __fastcall Change(TObject *Sender,Exfileviewlib_tlb::IFiles *Files)
{
}

procedure Change(ASender: TObject; Files : IFiles);
begin
end;

procedure Change(sender: System.Object; e: AxEXFILEVIEWLib._IExFileViewEvents_ChangeEvent);
begin
end;

begin event Change(oleobject Files)
end event Change

Private Sub Change(ByVal sender As System.Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_ChangeEvent) Handles Change
End Sub

Private Sub Change(ByVal Files As EXFILEVIEWLibCtl.IFiles)
End Sub

Private Sub Change(ByVal Files As Object)
End Sub

LPARAMETERS Files

PROCEDURE OnChange(oExFileView,Files)
RETURN

Syntax for Change event, /COM version (others), on:

<SCRIPT EVENT="Change(Files)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function Change(Files)
End Function
</SCRIPT>

Procedure OnComChange Variant llFiles
	Forward Send OnComChange llFiles
End_Procedure

METHOD OCX_Change(Files) CLASS MainDialog
RETURN NIL

void onEvent_Change(COM _Files)
{
}

function Change as v (Files as OLE::Exontrol.ExFileView.1::IFiles)
end function

function nativeObject_Change(Files)
return

The following VB sample displays the files that have been changed in the browsed folder:

Private Sub ExFileView1_Change(ByVal Files As EXFILEVIEWLibCtl.IFiles)
    Dim f As EXFILEVIEWLibCtl.File
    For Each f In Files
        Debug.Print "'" & f.Name & "' " & IIf(f.Folder, "foder", "file") & " " & IIf(f.State = Added, "added", IIf(f.State = Changed, "changed", IIf(f.State = Deleted, "deleted", "unchanged")))
    Next
End Sub

Open a new Windows Explorer instance that browses the same folder as your control. Add new folders, remove folders, or change regular files. Your VB output should look like the following:

The 'New Folder (2)' foder - Added
The 'New Folder (2)' foder - Deleted
The 'New Folder' foder was deleted
The 'New Text Document.txt' file was added
The 'New Text Document.txt' file was changed

The following C++ sample displays the files that have been changed in the browsed folder:

#include "Files.h"
#include "File.h"
void OnChangeExfileview1(LPDISPATCH Files) 
{
	CFiles files( Files ); files.m_bAutoRelease = FALSE;
	for ( long i = 0; i < files.GetCount(); i++ )
	{
		CFile1 file = files.GetItem( COleVariant( long( i ) ) );
		CString strState;
		switch ( file.GetState() )
		{
			case 0: 
			{
				strState = "unchanged";
				break;
			}
			case 1: 
			{
				strState = "changed";
				break;
			}
			case 2: 
			{
				strState = "added";
				break;
			}
			case 3:
			{
				strState = "deleted";
				break;
			}
		}
		CString strOutput;
		strOutput.Format( "'%s' %s %s\n", file.GetName(), (file.GetFolder() ? "folder" : "file" ), strState );
		OutputDebugString( strOutput );
	}
}

The following VB.NET sample displays the files that have been changed in the browsed folder:

Private Sub AxExFileView1_Change(ByVal sender As Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_ChangeEvent) Handles AxExFileView1.Change
    Dim f As EXFILEVIEWLib.File
    For Each f In e.files
        Debug.WriteLine("'" & f.Name & "' " & IIf(f.Folder, "foder", "file") & " " & IIf(f.State = EXFILEVIEWLib.ChangeEnum.Added, "added", IIf(f.State = EXFILEVIEWLib.ChangeEnum.Changed, "changed", IIf(f.State = EXFILEVIEWLib.ChangeEnum.Deleted, "deleted", "unchanged"))))
    Next
End Sub

The following C# sample displays the files that have been changed in the browsed folder:

private void axExFileView1_Change(object sender, AxEXFILEVIEWLib._IExFileViewEvents_ChangeEvent e)
{
	for (int i = 0; i < e.files.Count; i++)
	{
		EXFILEVIEWLib.File file = e.files[i];
		string strOutput = "'" + file.Name + "' ";
		strOutput += (file.Folder ? "folder" : "file") + " ";
		strOutput += (file.State == EXFILEVIEWLib.ChangeEnum.Added ? "added" : (file.State == EXFILEVIEWLib.ChangeEnum.Deleted ? "deleted" : (file.State == EXFILEVIEWLib.ChangeEnum.Changed ? "changed" : "unchanged")));
		System.Diagnostics.Debug.WriteLine(strOutput);
	}
}

The following VFP sample displays the files that have been changed in the browsed folder:

*** ActiveX Control Event ***
LPARAMETERS files

with files
	local i
	for i = 0 to .Count - 1
		with .Item(i)
			wait window nowait .Name + " " + str(.State)
		endwith
	next
endwith